Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Opening text files with CR format

by linuxer (Deacon)
on Aug 03, 2009 at 12:12 UTC ( #785422=note: print w/ replies, xml ) Need Help??


in reply to Opening text files with CR format

Hi,

have a look at perlvar; search for $INPUT_RECORD_SEPARATOR

You can set that variable to the needed character/string to parse your files...

Example snippet:

#! /usr/bin/perl use strict; use warnings; # ... for my $file ( @files ) { if ( open my $fh, '<', $file ) { # see perldoc perlvar local $/ = "\x0d"; @lines = <$fh>; } else { warn "$file: $!\n"; } }


Comment on Re: Opening text files with CR format
Select or Download Code
Re^2: Opening text files with CR format
by knith (Initiate) on Aug 03, 2009 at 12:30 UTC
    Thanks a million, you just saved me a lot of frustation time :P

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2014-12-22 12:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (116 votes), past polls