Re: confused - if function

2004-04-28 Thread Jeff Westman
You are absolutely correct, that the my is included inside the { } block. But that is exactly where the confusion sets in, having had this problem when I started coding in perl. The { } are required when using an if/else construct -- part of the syntax to perform this function. Whereas a bloc

Re: confused - if function

2004-04-27 Thread William.Ampeh
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 { . . }; pr

Re: confused - if function

2004-04-27 Thread James Edward Gray II
On Apr 27, 2004, at 5:39 AM, mike wrote: 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; an