[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Omaha.pm] Net::SSH::Perl Alternative Solution
Tony Simons wrote:
Unlike bash can I use variables in '$test' "$test"...haven't had a
chance to try it yet.
When you use the double-quote -- " -- you can use $variables, but with
the single-quotes -- ' -- the variables are ignored.
$ cat -n d6.pl ; perl d6.pl
1 #!perl
2 $VAR="Hello";
3 printf "single quotes: SERIALNUMBER=\"asdf $VAR 123123123\"\n";
4 printf 'double quotes: SERIALNUMBER="asdf $VAR 123123123"';
5 printf "\n";
6 printf 'mixed quotes: SERIALNUMBER="asdf '.$VAR.' 123123123"'."\n";
single quotes: SERIALNUMBER="asdf Hello 123123123"
double quotes: SERIALNUMBER="asdf $VAR 123123123"
mixed quotes: SERIALNUMBER="asdf Hello 123123123"
I'm sure someone will come up with an internal perl variable to change
the meaning of the double-quote characters, or some other Guru-level
hint. :-)
Dan
--
- - - -
"Wait for that wisest of all counselors, time." -- Pericles "I do not
fear computers, I fear the lack of them." -- Isaac Asimov