Rider <> wrote:
>I want to exclude all the lines that start with 0 and print only the
>lines starting with non-zeroes.
>
>Here is the script and I am not sure what is wrong here. Can some one
>help me in correcting the syntax error here? Or even a short-cut like
>one liner?
>
>+++++++++++++++++++++
>while(<DATA>)
> {
> if (^$_ == 0)
What is
^$_
supposed to do? Even if you meant to write a RE, it still doesn't make
much sense to numerically compare it to 0.
> {
> next;
> print;
> }
>}
while (<>){
print unless /^0/;
}
while (<>){
print unless substr($_, 0, 1) eq '0';
}
I'm sure there are many more possible ways.
jue
|