I wrote on 07/08/2009 09:50 AM: >> #!/usr/bin/perl -w >> # Prog for demostrating file name concatenations. >> $prefix="log"; >> $suffix=".gz"; >> >> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); >> # Time >> $middle=sprintf "%4d-%02d-%02d \n",$year+1900,$mon+1,$mday; >> print "My Date : $middle \n"; >> $file_name=join("_",$prefix.$middle.$suffix); >> print "New File name : $file_name \n"; >> >> I am getting value of $file_name as >> >> New File name : 1250_RDE_2009-07-07 >> .gz > > The script above has a different output for me, i.e.: > > ----- > My Date : 2009-07-08 > > New File name : log_2009-07-08 > _.gz > ------
I'm sorry. The actual output from the quoted script was ---- My Date : 2009-07-08 New File name : log2009-07-08 .gz ---- This is because join expects a list as its second parameter. That means it should be $file_name=join("_",($prefix,$middle,$suffix)); instead of $file_name=join("_",$prefix.$middle.$suffix); bye Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/