in reply to system pwd

vbrtrmn,
I am not sure why it is showing $var1 in the dump as I am not a Data::Dumper expert, but you are setting the variable equal to the return code of the system command - and hence it is showing 0.

The reason you are getting the pwd is because pwd prints to standard out.

If you want to capture the output of the pwd in the variable use my $dir = `pwd`;

Cheers - L~R

Replies are listed 'Best First'.
Re: Re: system pwd
by crouchingpenguin (Priest) on May 21, 2003 at 23:27 UTC

    And you can use the Dump method so the dump shows the actual variable name instead of $VAR1:

    #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Cwd; my $dir = getcwd(); print Data::Dumper->Dump([$dir],[qw(*dir)]),"\n";

    Update: as well as what jkahn said, of course =]


    cp
    ----
    "Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."