Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- How to exclude the lines that start with 0?
September 26, 2010, 1:50 am
rate this thread
It has been a long time I fiddled with perl scripts.
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
if (^$_ == 0)
Re: How to exclude the lines that start with 0?
supposed to do? Even if you meant to write a RE, it still doesn't make
much sense to numerically compare it to 0.
print unless /^0/;
print unless substr($_, 0, 1) eq '0';
I'm sure there are many more possible ways.
- » FAQ 4.74 How do I print out or copy a recursive data structure?
- — Next thread in » PERL Discussions