Home > Archive > PERL Beginners > October 2006 > using backticks
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| John Wright 2006-10-06, 3:57 am |
| Hi All,
i am getting error "The system cannot find the path specified" while running below lines code.
$dirname = "util";
$path = ` cd $dirname ; pwd`
print ("$path");
can anybody help me to get output of pwd in the variable $path.
Thank
________________________________________
__________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
| |
| Rob Dixon 2006-10-06, 3:57 am |
| john wright wrote:
>
> i am getting error "The system cannot find the path specified" while running
> below lines code.
>
> $dirname = "util"; $path = ` cd $dirname ; pwd` print ("$path");
>
> can anybody help me to get output of pwd in the variable $path.
Hi John
It's best to do things in Perl if at all possible:
use strict;
use warnings;
use Cwd;
chdir 'util' or die $!;
my $path = cwd;
print "$path\n";
HTH,
Rob
| |
| John W. Krahn 2006-10-06, 3:57 am |
| john wright wrote:
> Hi All,
Hello,
> i am getting error "The system cannot find the path specified" while running below lines code.
>
> $dirname = "util";
> $path = ` cd $dirname ; pwd`
> print ("$path");
>
> can anybody help me to get output of pwd in the variable $path.
use Cwd;
my $dirname = 'util';
chdir $dirname or die "Cannot 'chdir $dirname' $!";
my $path = getcwd;
print $path;
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
|
|
|
|
|