Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Using scalar variable in system set of commands

by choroba (Canon)
on Nov 01, 2012 at 14:37 UTC ( #1001839=note: print w/ replies, xml ) Need Help??


in reply to Using scalar variable in system set of commands

By using the backslash, you prevent $month from being interpolated in the doublequotes. The shell then gets $month and tries to expand it - but there is no shell variable named $month.

لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: Using scalar variable in system set of commands
Re^2: Using scalar variable in system set of commands
by tobyink (Abbot) on Nov 01, 2012 at 14:50 UTC
    Indeed. The backslashes before the pipes are also unnecessary.
    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001839]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2015-07-05 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls