From: [EMAIL PROTECTED]
open (IN, a.txt) ;
while (IN) {
chomp ($line = );
# $line contains line from a.txt
No $line contains a line from a file whose name is in @ARGV or from
STDIN. You wanted
$line = IN
!!!
Jenda
== [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
open (IN, a.txt) ;
while (IN) {
chomp ($line = );
# $line contains line from a.txt
No $line contains a line from a file whose name is in @ARGV or from
STDIN. You wanted
$line = IN
!!!
No ... :-)
The while(IN) reads a line into $_. So, just chomp;
I think Jenda's original post of $line = IN was meant to be like this:
open (IN, a.txt) ;
while ($line = IN) {
# $line contains line from a.txt
}
Why not just do chomp; ? Since we are using $_, it will work on it without
any var...
open (IN, a.txt) ;
while (IN) {
chomp;
# $line
From: Rodney Wines [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
open (IN, a.txt) ;
while (IN) {
chomp ($line = );
# $line contains line from a.txt
No $line contains a line from a file whose name is in @ARGV or from
STDIN. You wanted
$line = IN
!!!
No
I am using a while loop to read a file like
open (IN, a.txt ) )
while(IN)
{
---
---
}
This will read the entire file reading line by line.Now the problem is that
inside the while loop at some particular place i want to read just one
line(next line) without going back to main loop.I am trying
open (IN, a.txt) ;
while (IN) {
chomp ($line = );
# $line contains line from a.txt
}
-Original Message-
From: saurabh.saxena
Sent: 04 June 2001 09:44
To: perl-win32-users; activeperl
Cc: saurabh.saxena
Subject: How to read a single line
file).
@lines = IN;
-- Petr Smejkal
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
Saxena, Saurabh
Sent: Monday, June 04, 2001 10:44 AM
To: 'Perl1'; 'Perl2'
Subject: How to read a single line from file
I am using a while loop to read a file like
- Original Message -
From: Shawn [EMAIL PROTECTED]
To: Saxena, Saurabh [EMAIL PROTECTED]
Cc: 'Perl1' [EMAIL PROTECTED]; 'Perl2'
[EMAIL PROTECTED]
Sent: Monday, June 04, 2001 11:20 AM
Subject: RE: How to read a single line from file
Ok, try this:
open (IN, a.txt);
my $found_x
Yes, grep has some great benefits if used properly! Unfortunately a lot of
people, myself included up until a couple of months ago, either don't know
about or how to use it. I didn't figure I would throw it out there since
there was already some confusion :-)
Shawn
Or in a shorter way: