in reply to cleaning up spaces on either side of an extracted string

Well, it appears that in some circumstances, either $key, $val or possibly both can be undefined. Since that probably indicates a problem with the syntax of your input file, you should test for it:
unless (defined($key) && defined($val)) { warn "Problem in input: <$index>\n"; } else { $key =~ s"^\s+""g; $key =~ s"\s+$""g; $val =~ s"^\s+""g; $val =~ s"\s+$""g; $hash_ref->{$key} = $val; }

Replies are listed 'Best First'.
Re: Re: cleaning up spaces on either side of an extracted string
by pacman (Initiate) on Mar 19, 2004 at 09:02 UTC
    hey mat thanks for the tip , it worked :D