dirac has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks!
I have tried to extract the name of the running script without his extension, to create a new file with same name but with ".log" at end.
On win32 it works fine, but on Solaris I get only ".log".
This is the code:
#!/usr/local/bin/perl -w # my_script_name.pl use strict; my $log_file = (split /\./, $0)[0] . '.log'; print $log_file, "\n";
On Win32 the output is:
my_script_name.log
On Solaris with perl, v5.8.8 built for sun4-solaris
.log
Any suggestions?
Thanks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Different behavior when parsing $0 on Solaris and Win32
by liverpole (Monsignor) on Sep 28, 2011 at 12:55 UTC | |
Re: Different behavior when parsing $0 on Solaris and Win32
by Corion (Patriarch) on Sep 28, 2011 at 12:46 UTC | |
by toolic (Bishop) on Sep 28, 2011 at 12:53 UTC | |
by dirac (Beadle) on Sep 28, 2011 at 13:23 UTC | |
by dirac (Beadle) on Sep 28, 2011 at 13:35 UTC | |
Re: Different behavior when parsing $0 on Solaris and Win32
by toolic (Bishop) on Sep 28, 2011 at 12:49 UTC | |
Re: Different behavior when parsing $0 on Solaris and Win32
by TomDLux (Vicar) on Sep 28, 2011 at 18:04 UTC |
Back to
Seekers of Perl Wisdom