Start reading from a specific line

2005-02-14 Thread Eduardo Vázquez Rodríguez
Hello Perl Programmers I have a question regarding openning a file How can I start reading a file from n line? For example I open a File like this way open(INPUT, $file) while () { do something with $_; } But It starts to read from line #1, what I want is that start reading exactly from lin

RE: Start reading from a specific line

2005-02-14 Thread Jason Balicki
Eduardo Vázquez Rodríguez wrote: > How can I start reading a file from n line? > For example > I open a File like this way > open(INPUT, $file) > while () > { > do something with $_; > } I'm a newbie myself, but is there a reason you've already discounted something like

Re: Start reading from a specific line

2005-02-14 Thread John W. Krahn
Eduardo Vázquez Rodríguez wrote: Hello Perl Programmers Hello, I have a question regarding openning a file How can I start reading a file from n line? For example I open a File like this way open(INPUT, $file) while () { do something with $_; } But It starts to read from line #1, what I want is

Re: Start reading from a specific line

2005-02-14 Thread John W. Krahn
Jason Balicki wrote: Eduardo Vázquez Rodríguez wrote: How can I start reading a file from n line? For example I open a File like this way open(INPUT, $file) while () { do something with $_; } I'm a newbie myself, but is there a reason you've already discounted something

Re: Start reading from a specific line

2005-02-14 Thread DBSMITH
Subject Re: Start reading from a specific

RE: Start reading from a specific line

2005-02-14 Thread Eduardo Vázquez Rodríguez
Thanks I prove it and worked! -Original Message- From: [EMAIL PROTECTED] To: Perl Beginners Sent: 2/14/2005 5:13 PM Subject: Re: Start reading from a specific line if you want to use a built in function then use $. or its alternatives $NR, or $INPUT_LINE_NUMBER By definition

Re: Start reading from a specific line

2005-02-14 Thread John W. Krahn
[EMAIL PROTECTED] wrote: if you want to use a built in function then use variable $. or its alternatives $NR, or $INPUT_LINE_NUMBER Which implys that you are using the 'English' module which is a bad idea if speed is importan

RE: Start reading from a specific line

2005-02-15 Thread DBSMITH
cc Subject RE: Start reading from

RE: Start reading from a specific line

2005-02-15 Thread Jeff 'japhy' Pinyan
On Feb 15, [EMAIL PROTECTED] said: my $linect="$."; while ( ) { if ( $linect > 9 ) { do whatever ... } $linect++; } need to use double-quotes around variable $. No you don't. my $linecount = $.; works just fine. And is there a reason you don't want to use $.? That is, why cr

Re: Start reading from a specific line

2005-02-15 Thread Eduardo Vázquez Rodríguez
I know that programming is not one of my best skills, but this code works for me, your help is very appreciate open(INPUT, $file) or die "Can't read from file: $! $file"; # Where we "move" the pointer to line number 10 $. = 0; do { $_ = } until $. == 10; wh

RE: Start reading from a specific line

2005-02-15 Thread DBSMITH
cc 02/15/2005 10:38 'Perl Beginners ' AM Subject

Re: Start reading from a specific line

2005-02-15 Thread Jeff 'japhy' Pinyan
On Feb 15, Eduardo Vázquez Rodríguez said: open(INPUT, $file) or die "Can't read from file: $! $file"; # Where we "move" the pointer to line number 10 $. = 0; You don't need to initialize $. to 0. It's a magical variable that holds the right value. -- Jeff "japhy" Pinyan % How can

RE: Start reading from a specific line

2005-02-15 Thread Wagner, David --- Senior Programmer Analyst --- WGO
> cc 02/15/2005 10:38 'Perl Beginners ' > AM > >Subject RE: Start reading from >a specific line > > > > > &

RE: Start reading from a specific line

2005-02-15 Thread Jenda Krynicky
From: [EMAIL PROTECTED] > you are correct, you do not need " " around $. > thank you! > I was using strict and warnings, but must of had another error. > I am unfamiliar with the variable $.? I tried playing with it, but > was unsuccessful. I could not find it in cookbook nor in programming > per

RE: Start reading from a specific line

2005-02-15 Thread DBSMITH
AM cc Subject RE: Sta

RE: Start reading from a specific line

2005-02-15 Thread Jeff 'japhy' Pinyan
On Feb 15, [EMAIL PROTECTED] said: Could not find this variable in perlvar under 5.8.0 for sun solaris can you explain it? perlmonk:~ 101:$ perldoc perlvar ... $. Current line number for the last filehandle accessed. Each filehandle in Perl counts the number of lines that have

RE: Start reading from a specific line

2005-02-15 Thread Jenda Krynicky
From: [EMAIL PROTECTED] > Could not find this variable in perlvar under 5.8.0 for sun solaris > can you explain it? > > Derek B. Smith No. It has always been there since I can remember. (Perl 5.001 I think, definitely Perl 5.003) Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =

RE: Start reading from a specific line

2005-02-15 Thread Graeme St. Clair
And p665 (correct this time!) gives you the goods. Rgds, GStC. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 15, 2005 11:01 AM To: 'Perl Beginners ' Subject: RE: Start reading from a specific line you are correct, you do not need

RE: Start reading from a specific line

2005-02-15 Thread DBSMITH
cc PM Subject RE: Start reading from a specific

Re: Start reading from a specific line

2005-02-15 Thread John W. Krahn
Jenda Krynicky wrote: From: [EMAIL PROTECTED] Could not find this variable in perlvar under 5.8.0 for sun solaris can you explain it? No. It has always been there since I can remember. (Perl 5.001 I think, definitely Perl 5.003) It has been there since Perl verion 1.0 but back then it was readonly

Re: Start reading from a specific line

2005-02-15 Thread John W. Krahn
Jeff 'japhy' Pinyan wrote: On Feb 15, Eduardo Vázquez Rodríguez said: open(INPUT, $file) or die "Can't read from file: $! $file"; # Where we "move" the pointer to line number 10 $. = 0; You don't need to initialize $. to 0. It's a magical variable that holds the right value. That depends.