Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: file reading issues

by bofh_of_oz (Hermit)
on Aug 03, 2005 at 19:13 UTC ( #480604=note: print w/replies, xml ) Need Help??

in reply to file reading issues

A regex will parse the file just fine. Just grab the whole file into a variable, then do this:

#Sample data, multiline $line = "<!-- Begin -->Line one\nLine two\nthree\nfour<!-- End -->"; #process them $line =~ s/<!-- Begin -->(.*)<!-- End -->/$1/s; print $line;

I tried to do the same while reading the file line-by-line... The code was so ugly that I simply recommend to read in the whole file at once and do a multiline regexp above...


An idea is not responsible for the people who believe in it...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://480604]
[shmem]: Old_Gray_Bear would nod, and go back to sleep, then - but he's been sleeping for a year now.
[erix]: "AngloZionist Empire"? "Stop the Empire's war on Russia?" WTF?
erix stops reading as recommended by the blog itself
[erix]: my attention being jealously guarded ;)
[shmem]: erix, yes, it's a WTF. Since...
[erix]: antisemitic && (pro-)russian. Makes sense :P
[shmem]: erix: what's antisemitic in there? Tell me.
[erix]: AngloZionist
[shmem]: and it is *not* pro-russian. It describes the western world.

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2018-03-19 20:51 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (246 votes). Check out past polls.