Booher Timothy B 1stlt Afrl/Mnac wrote: > o.k. my program finally works (thanks for the help yesterday) . . . but I am > convinced I am doing this the long way . . . I am sure there is a more > elegant solution (prob a one-liner). Any thoughts . . .
> #!/usr/bin/perl -w > # This program is just to test my ability to parse > > open(MYFILE,'test2.txt'); > $lNum = 1; > > while (<MYFILE>){ > $line = $_; > chomp($line); > next if $line =~ (/^\*+/)|(/^\s*$/); # no blank lines or lines that > start with *** > @splitLine = split(/:\s/,$line); # divide > $splitLine[0] =~ s/^\s*//; # remove leading spaces from each > one > $splitLine[1] =~ s/^\s*//; > $splitLine[0] =~ s/^\s+$//; # remove trailing spaces from each > one > $splitLine[1] =~ s/^\s+$//; > print "$lNum\: \"$splitLine[0]\",\"$splitLine[1]\"\n"; > $lNum++; > }; Have you checked the CPAN module String::Strip ?! Greetings, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]