in reply to Shorten windows paths too long
`H:; cd $olddirname; cd ..; move /Y $olddirname $newname` or die "Can' +t move $olddirname $newname: $!";
That is pretty broken code. `` (qx<>) doesn't return a boolean. It returns the output of the commands. So you are dieing if that command produces no output. And $! usually is irrelevant after qx() fails.
my $output= qx(H:; cd $olddirname; cd ..; move /Y $olddirname $newname +); if( 0 != $? ) { die "Can't move $olddirname $newname: $output"; }
Might be closer to correct.
- tye
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Shorten windows paths too long (qx)
by gj2666 (Beadle) on Aug 18, 2010 at 15:45 UTC |
In Section
Seekers of Perl Wisdom