Mad_Mac has asked for the wisdom of the Perl Monks concerning the following question:
I have a bit of code I've used more than once when programming in Windows. I often suspect there is a more elegant single line that will accomplish the same thing
my $appPath=`echo %localappdata%`; chomp $appPath; my $applicationPath="$appPath".'\someApplication\';
Is there a way to compress this into fewer steps?
Thanks
EDIT
After the advice of the wise and patient monks, I was able to replace those 3 lines of code with one:
my $appPath = "$ENV{localappdata}\\someApplication";
NICE.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Chomp, Concatenation and paths
by Anonymous Monk on Jun 25, 2010 at 17:13 UTC | |
by Mad_Mac (Beadle) on Jun 25, 2010 at 17:22 UTC | |
by Corion (Patriarch) on Jun 25, 2010 at 17:33 UTC | |
by Mad_Mac (Beadle) on Jun 25, 2010 at 19:58 UTC | |
by ikegami (Patriarch) on Jun 25, 2010 at 20:11 UTC | |
by Corion (Patriarch) on Jun 25, 2010 at 19:59 UTC | |
by sierpinski (Chaplain) on Jun 25, 2010 at 19:23 UTC | |
by Mad_Mac (Beadle) on Jun 28, 2010 at 09:40 UTC |