It works, but it prints nothing. You are basically dealing with 3 variable
here. the first 2 $date1 goes out of scope outside if {} else {}.
Simply move your declaration out of the if statement. That is:
my $date1 = "";
if ( your condition){
$date1=localtime;
}
else {
.
.
};
print $date1;
__________________
William Ampeh (x3939)
Federal Reserve Board
mike
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
cc.co.uk> cc:
Subject: confused - if function
04/27/2004 06:39
AM
I am getting a bit confused here, if I uncomment out the print statement
within the if block $date1 prints, however the $date1 after the if block
doesn't
if ($date eq ''){
my $date1=localtime;
#print $date1;
}
else {
my $date1=~$date;
};
print $date1;
any ideas
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>