Kyle R . Burton on Wed, 2 May 2001 13:54:23 -0400 |
On Wed, May 02, 2001 at 01:48:11PM -0400, Susan J. Talbutt wrote: > We're beating our heads against a wall here. The office mate swears perl > has a way to read in an entire file in one gulp (as opposed to the more > familiar <> operator). > > Can anyone confirm or deny? open FILE, "<file.txt" or die "error opening file.txt: $!\n"; my $data; {local$/=undef;$data=<FILE>;} close FILE; $/ is the input record seperator, it's normally set to "\n". Setting it to undef causes <> to read the entire file. The braces create a new block, and the 'local $/' prevents our change from effecting other code. k -- ------------------------------------------------------------------------------ Of course power tools and alcohol don't mix. Everyone knows power tools aren't soluble in alcohol... -- Crazy Nigel mortis@voicenet.com http://www.voicenet.com/~mortis ------------------------------------------------------------------------------ **Majordomo list services provided by PANIX <URL:http://www.panix.com>** **To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**
|
|