Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Input Record Separator WON'T WORK!

by rgiskard (Hermit)
on Jan 25, 2008 at 00:07 UTC ( #664172=note: print w/replies, xml ) Need Help??


in reply to Input Record Separator WON'T WORK!

It would be great if you could include some of your code to look at; you'll find it helps a lot.

Otherwise, everybody (myself included) will probably suggest that you start using regular expressions to solve your tokenizing dilemma.

Update Here's an example of code using that character you keep talking about. Lemme know if it solves your problem; otherwise post some code.
my $schtuff = "blah ENDOFLINE blah ENDOFLINE blah ENDOFLINE\n"; open my $DEADEND, ">schtuff.txt" or die 'try again'; { print $DEADEND $schtuff; } close $DEADEND; open my $moreSchtuff, "<schtuff.txt" or die $!; { local $/ = 'ENDOFLINE'; while (<$moreSchtuff>) { print $_ . "<-- SHAZAM! properly tokenized!\n"; } } close $moreSchtuff;
5.8.8 Output
blah ENDOFLINE<-- SHAZAM! properly tokenized! blah ENDOFLINE<-- SHAZAM! properly tokenized! blah ENDOFLINE<-- SHAZAM! properly tokenized!

Replies are listed 'Best First'.
Re^2: Input Record Separator WON'T WORK!
by stalepretzel (Initiate) on Jan 25, 2008 at 00:26 UTC
    I'm not sure I understand.... I mean... I'll need to use regular expressions to WORK with the data that I read, but this file has the potential to be HUGE, and it would be very memory intensive if I had to read the whole file at once. Could you clarify?
Re^2: Input Record Separator WON'T WORK!
by stalepretzel (Initiate) on Jan 25, 2008 at 00:48 UTC
    Sigh..... It works, and I can't even be excited because I'm still not sure why... but thanks for your help. I'll use all of your suggestions if it stops working again....

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://664172]
help
Chatterbox?
[Corion]: marto: Yeah - their mother picked all three of them up at the kindergarden to then go to the hospital, and all three of them were well behaved, and all also were quite obedient when they came home, so they recognized the situation
[Corion]: Nice to see that the kids have some understanding of important things that happen and the appropriate behaviour :)
[marto]: at times mine surprise me with this behavior :)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2016-12-08 09:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (137 votes). Check out past polls.