-imran#!/usr/bin/perl use strict; doStuff(); # no need for & foo(); sub doStuff { # want to read the file as a single string.... local $/; # if you don't set it to anything, it is undefined open TMP, "<somefile.txt"; my $file = <TMP>; # $file since you are putting the whole file into + a scalar, not a list close TMP; # do more stuff with that file... } sub foo { ## here i would want to read the file line-by-line open TMP, "<otherfile.txt"; my @file = <TMP>; close TMP; }
In reply to Re: switching default line terminator?
by CountOrlok
in thread switching default line terminator?
by rmexico
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |