From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of zilore
mumba
Sent: 15 November 2008 11:22
To: [email protected]
Subject: Long directory structure on one line
> Perl Users,
> Firstly my apologies for my very elementary knowledge of Perl.
> Thanks to ideas from Sena and Mustafa, and a lot of assistance from
Bill Luebkert on an earlier script, I have > below a snippet from a
script which I tohught should work.
> The problem is $base_dir, which is supposed to be
> /home/Mumba/archive/11-November08/ukmo/20081115 is being put on
several lines as
> /home/Mumba/archive/11
> -
> November08
> Hence my chdir ("$base_dir/$dat") gives the error "cannot cd", no such
file or directory. I have another script > which works, with a similar
but even longer directory. I do not see the difference.
> Is there some trick I can do to force the whole directory on one line?
> Thanks
>
>
> my $base_dir="/home/Mumba/archive/$model_mon$dash$mon_name$yr/$model";
The problem (probably) lies in the code that you are not showing. If you
are still populating some of those variables by `date ...`, then they
will be terminated by a newline character. You should 'chomp' them, or
better still, use strftime.
Easy to check:
my $model_mon =`date "+%m"`;
print "model_mon='$model_mon'\n";
Compared to:
my $model_mon = srftime "%m", localtime;
print "model_mon='$model_mon'\n";
HTH
--
Brian Raven
-----------------------------------------------------------------------------------------------------------
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient or have received this e-mail in error, please advise
the sender immediately by reply e-mail and delete this message and any
attachments without retaining a copy. Any unauthorised copying, disclosure or
distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs