Trina Espinoza wrote:
>
> 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.
By empty do you mean the null string "":
if ( $item eq $tempitem or $item eq '' ) {
Or do you mean the value 'undef':
if ( $item eq $tempitem or not defined $item ) {
> 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) {
! will return '1' if $tempitem is false or '' if $tempitem is true. $1
will never be equal to either value.
> do an action;
> }else{
> do some other action;
> undef $tempitem;
>
> or
>
> If ($item =~ /^(\D+)(\d+)/ {)
> If ($1 eq defined(!$tempitem)) {
defined(!$tempitem) will always be true so it will never be equal to $1.
> do an action;
> }else{
> do some other action;
> undef $tempitem;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>