Dave,

(this is one I know :-) )


I want to skip the blank lines and just print the lines with text, like this
this
is myfile

This is my test case code. #!/usr/bin/perl -w
use strict;

my $opt_testfile="test-text.txt";
open (TS, $opt_testfile) or die "can't open file";
while (<TS>) {
    chomp;
    next if ($_ =~ /^\s+/);

next if ($_ =~ /^\s+/);

You skip lines that BEGIN with a space.
The REGEX you want is
/^\s*$/

HTH
Alois

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to