Description: | I think that both of these use the minimum amount of code. (doing the job properly - using my and close) Post if you have a better way! |
sub readfile { my $OP ; open FS, $_[0] ; while (<FS>) {$OP .= $_} close FS ; return $OP ; }
Returns the contents of a file in list form (line by line)
sub readlines { open FS, $_[0] ; my (@OP) = <FS> ; close FS ; return (@OP) ; }
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: Return the contents of a file
by btrott (Parson) on Feb 04, 2000 at 23:31 UTC | |
by turnstep (Parson) on Apr 12, 2000 at 18:02 UTC | |
by anders (Initiate) on May 26, 2000 at 17:41 UTC | |
by Chris (Novice) on Apr 12, 2000 at 05:50 UTC | |
by btrott (Parson) on Apr 12, 2000 at 07:18 UTC | |
RE: Return the contents of a file
by chromatic (Archbishop) on Apr 12, 2000 at 18:43 UTC |