Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: using split on a file

by lolindrath (Scribe)
on Jan 02, 2001 at 10:27 UTC ( #49259=note: print w/ replies, xml ) Need Help??

in reply to using split on a file

Ok, this is what worked for me (adapted to your code a little). I was using and when I just undefined $/ it really screwed some stuff up.

my $OldNewLine = $/; $/ = undef; open( FILE, "file" ); my @List = split( /\n%{5}\n/, <FILE> ); close (FILE); $/ = $OldNewLine;
Update: Ignore the above code look at the reply below this.


Comment on Re: using split on a file
Download Code
Replies are listed 'Best First'.
Re: Re: using split on a file
by eg (Friar) on Jan 02, 2001 at 14:39 UTC

    Or, you can use a block. It's neater.

    my @List=(); { local $/ = undef; open( FILE, "file" ); @List = split( /\n%{5}\n/, <FILE> ); close (FILE); } # $/ is back to what it used to be!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://49259]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2015-11-30 13:14 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (770 votes), past polls