in reply to Re^3: Chomp, Concatenation and paths
in thread Chomp, Concatenation and paths

OK, I get it. I could use that instead of a system call. I don't see how that saves me a step, other than maybe I don't need to chomp?

Replies are listed 'Best First'.
Re^5: Chomp, Concatenation and paths
by ikegami (Patriarch) on Jun 25, 2010 at 20:11 UTC

    "One step" is quite an understatement. You're spawning a new process (which involves fetching %ENV), executing a shell, executing a shell command, checking for errors (or not) and parsing the response in order to get a value Perl already had to begin with.

    Using $ENV{localappdata} saves an incredible number of steps.

    Also, it doesn't return "Echo is on" if the variable isn't set, and it's portable.

    Update: Added last paragraph.

Re^5: Chomp, Concatenation and paths
by Corion (Patriarch) on Jun 25, 2010 at 19:59 UTC
    print "$ENV{localappdata}\\someApplication\\";