[NEWBIE] Trivial?
- From: El Bandolero <el_bandolero@xxxxxxxxx>
- Date: Sat, 29 Sep 2007 07:39:57 +0200
I'm solving an exercise studying on a tutorial
The task is to print the (empty or not) lines of a file numbering only the
non empty ones.
How the h### is possible that the following code gives the same result if I
change line 9 with the opposite condition?
if (!$lines[$i]=="")
1 #!/usr/bin/perl
2 #
3 $file = 'C:\Perl\html\Artistic.txt';
4 open(PIP, $file);
5 @lines = <PIP>;
6 close(PIP);
7 for ($i=0;$i <= @lines;++$i)
8 {
9 if ($lines[$i]=="")
10 {print $i." ".$lines[$i]};
11 }
--
ciao
Bando
.
- Follow-Ups:
- Re: [NEWBIE] Trivial?
- From: John W. Krahn
- Re: [NEWBIE] Trivial?
- From: Mumia W.
- Re: [NEWBIE] Trivial?
- Prev by Date: Re: Using fcntl and |= - "Argument .... isn't numeric in bitwise or ..."
- Next by Date: Re: [NEWBIE] Trivial?
- Previous by thread: Get unlimited visitors to your website
- Next by thread: Re: [NEWBIE] Trivial?
- Index(es):
Relevant Pages
|