On Jan 3, Booher Timothy B 1stLt AFRL/MNAC said: >while (<MYFILE>){ > $line = $_;
Why use $line here when you can use $_ instead? > chomp($line); > next if $line =~ (/^\*+/)|(/^\s*$/); # no blank lines or lines that That is still busted. Pick one of these: next if $line =~ /^\*/ or $line =~ /^\s*$/; # or next if $line =~ /^(\*|\s*$)/; > @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+$//; That doesn't remove trailing spaces. > print "$lNum\: \"$splitLine[0]\",\"$splitLine[1]\"\n"; > $lNum++; >}; Here's how I would write it: while (<FILE>) { chomp; next if /^\*/ or /^\s*$/; my ($field, $value) = split /\s*:\s+/; $field =~ s/^\s+//; # remove leading spaces from $field $value =~ s/\s+$//; # remove trailing spaces from $value print qq{$lnum: "$field","$value"\n}; $lnum++; } Does that make sense to you? I've "cheated" by modifying the split() a bit. It ends up consuming the spaces before and after the colon, so that $field can't POSSIBLY have trailing spaces, and $value can't POSSIBLY have leading spaces. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]