Perl equivalent of PHP's get_file_contents()?

混江龙づ霸主 提交于 2019-12-14 00:48:46

问题


The following PHP code does exactly what I want to do. The problem is I need to re-create it in Perl and I've been playing around with the open() and sysopen() Perl functions but can't do it. Does anyone have any help or know of any links that might help? Thanks.

$URL = "http://example.com/api.php?arguments=values";
echo file_get_contents($URL);

回答1:


You can make use of LWP:

use LWP::Simple;
$contents = get $URL or die;
print $contents;


来源:https://stackoverflow.com/questions/3413151/perl-equivalent-of-phps-get-file-contents

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!