Re: php to perl
| From: | Daniel Andersen | Date: | Wed, 19 Mar 2003 04:22:36 +0000 |
| Subject: | Re: php to perl | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140248@lists.php.net to get a copy of this message | ||
<?
$fp = fopen ('/proc/loadavg', 'r');
if (!$fp) die ('Failed to open file');
while ($line = fgets ($fp)) {
$loadavg = substr ($line, 0, 4);
}
fclose ($fp);
?>
Regards,
Daniel
On Wed, 19 Mar 2003 13:16, Sebastian wrote:
> unfortunately i am a rookie with perl, can someone help me convert this
> little bit of code to php?
>
> thanks in advanced.
>
> #!/usr/bin/perl
> print "Content-type: text/html\n\n";
> open(LOADAVG, '/proc/loadavg') or die $1;
> while(<LOADAVG> ) {
> $loadavg = substr( $_, 0, 4 );
> }
> close(LOADAVG);
>
> cheers,
> - Sebastian