Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
If the 'undefined' warning bothers you you can fix it by making sure $tmp2 is always defined. This works wonders:
...which gives you the added bonus of scoping $tmp2. Plus, you don't have to check whether a character is present in your var before substituting it out. is better written as: If there's a single quote in $tmp2 it'll get escaped. Otherwise nothing happens. Note that you don't have to escape single-quotes within a regex. Lastly if you're paranoid about non-Alphanumerics in your regex's check out the \Q modifier. This does what you want automatically within a regular expression without you having to do anything else. Gary Blackburn Edited:Added my $tmp2=""; to really make $tmp2 defined. :-P In reply to Re: Use of uninitialized value in pattern match (m//)
by Trimbach
|
|