#!/usr/bin/perl -w use strict; my $firstNonBlankLine; while ($firstNonBlankLine = , $firstNonBlankLine !~ /\S/){} print $firstNonBlankLine; =prints This first non-"blank" line =cut __DATA__ This first non-"blank" line this is second non-blank line #### #!/usr/bin/perl -w use strict; while () { print if !/^\s$/; } =prints This first non-"blank" line this is second non-blank line =cut __DATA__ This first non-"blank" line this is second non-blank line