Re: Line Endings

2013-02-22 Thread Tiago Hori
Thanks, Guys. T. Sent from my iPhone On 2013-02-22, at 6:51 PM, *Shaji Kalidasan* wrote: > Greetings, > > Tiago, adding to Jim's and Andy's wisdom. Here is the complete code snippet > > [code] > use strict; > use warnings; > > unless(@ARGV == 1) { > die "Usage : $0 \n"; > } > > my $fil

Re: Line Endings

2013-02-22 Thread *Shaji Kalidasan*
Greetings, Tiago, adding to Jim's and Andy's wisdom. Here is the complete code snippet [code] use strict; use warnings; unless(@ARGV == 1) {     die "Usage : $0 \n"; } my $file = shift; my $fin = IO::File->new($file, 'r') or die "Cannot open file for read ($!)"; $fin->binmode(":raw"); my $conte

Re: Line Endings

2013-02-22 Thread Jim Gibson
On Feb 22, 2013, at 10:40 AM, Andy Bach wrote: > On Fri, Feb 22, 2013 at 12:08 PM, Tiago Hori wrote: > >> What I was wondering is: is there any way to force perl to use other line >> ending characters, like MacOS CR? >> Another approach is to read the entire file into a scalar and then split

Re: Selling Perl Code

2013-02-22 Thread Bill Stephenson
On Feb 22, 2013, at 3:59 AM, rjc wrote: > Hi Bill, > > This is a kind request directed to you but also to everyone else to > consider starting a new thread with a new message sent to the mailing > list rather than replying to a previous email and changing the Subject: > line. > > The rationale b

Re: Line Endings

2013-02-22 Thread Andy Bach
On Fri, Feb 22, 2013 at 12:08 PM, Tiago Hori wrote: > What I was wondering is: is there any way to force perl to use other line > ending characters, like MacOS CR? > Perl's "magic" var "$/" or via "use English" $RS or $INPUT_RECORD_SEPARATOR (Larry's mnemonic "as in poetry or think a mad slashe

Line Endings

2013-02-22 Thread Tiago Hori
Hi All, One problem that often encounter is with line endings. I have to parse several kinds of files routinely and often these are generated in excel and therefore it is hard to anticipate which line ending I actually have. It seems to me that during while loops, if the line ending is not a LF, t

Re: Selling Perl Code

2013-02-22 Thread rjc
Hi Bill, This is a kind request directed to you but also to everyone else to consider starting a new thread with a new message sent to the mailing list rather than replying to a previous email and changing the Subject: line. The rationale behind it is the fact that many email clients but also mai