From: "Trina Espinoza" <[EMAIL PROTECTED]> > I would like to know how I would say if $item equals $tempitem OR if > $item is empty(the variable is a placeholder that has nothing in it), > execute command.
I'd revert the tests. First see whether it's empty, then whether it equals something: if (!defined $item or $item eq $tempitem) { do something > Are either of these saying the above statement > because I don't seem to be getting the expected results. > > If ($item =~ /^(\D+)(\d+)/ {) > If ($1 eq !$tempitem) { I guess the capital "I"s were introduced by your mail client (I know some programs think they know better:-} Anyway the $1 eq !$tempitem doesn't really make sense. If you want to say "$1 does not equal to $tempitem" it should be either $1 ne $tempitem or !($1 eq $tempitem) or not ($1 eq $tempitem) In your version you first LOGICALY negate the $tempitem (which means that if $tempitem is 0, 0.0, "0", "" or undef you get 1, in all other cases you get an undef. And then you compare the 1 or undef with the $1. Not likely to be what you meant. > do an action; > }else{ > do some other action; > undef $tempitem; > > or > > If ($item =~ /^(\D+)(\d+)/ {) > If ($1 eq defined(!$tempitem)) { This is even more crazy :-) > do an action; > }else{ > do some other action; > undef $tempitem; Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>