I would go for...
sub first_line_from_file { my $fn = shift; open my $file, "<", $fn or die "unable to open file $fn"; scalar <$file> }
update: added the scalar in front of <$file>. blazar, thanks for pointing it out.
In reply to Re: Reopen file when contents changed?
by salva
in thread Reopen file when contents changed?
by bofh_of_oz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |