Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: using split on a file

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to using split on a file

Ok, this is what worked for me (adapted to your code a little). I was using CGI.pm 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.

--=Lolindrath=--

Replies are listed 'Best First'.
Re: Re: using split on a file
by eg (Friar) on Jan 02, 2001 at 09: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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://49259]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.