[Techtalk] Learning Perl!!!!
Katie Bechtold
katie at katie-and-rob.org
Wed Sep 11 15:38:06 EST 2002
On Wed, Sep 11, 2002 at 04:10:17PM -0700, kansas_kennedy at phreaker.net wrote:
> 2) What is the big fuss about 'foobar'? what is it exactly in Linux? Does
> it have any significance (like /dev/null)? I seen it being also used in
> Learning Perl book.
>From The Jargon File
(http://www.tuxedo.org/jargon/html/entry/foobar.html) :
foobar
Another widely used metasyntactic variable; see foo for etymology.
metasyntactic variable
A name used in examples and understood to stand for whatever thing
is under discussion, or any random member of a class of things under
discussion. The word foo is the canonical example.
> 3) And I am having some trouble with the problem in section 2.2.1.1 in Page
> 23 of Picking up Perl pdf. I don't understand why they are using " ' '
> " and then " "" " sort of alternatively. So far I learned that single
> quotes are used when we don't want to interpret anything and keep it as it
> is and double-quotes are used for interpolation.
Here's the example:
#!/usr/bin/perl
use strict;
use warnings;
print 2E-2, ' ', 9.77E-5, " ", 100.00, " ", 100_181_973, ' ',
9.87E9, " ", 86.7E14, "\n";
Now, you're correct that double quotation marks do variable
interpolation and backslash interpolation while single quotes
suppress interpolation. But I don't get the same results if I use
either one. When I run the example as is, I get:
[katie at blue katie]$ test.pl
0.02 9.77e-05 100 100181973 9870000000 8.67e+15
[katie at blue katie]$
But if I replace the double quotes around \n with single quotes, I
get this:
[katie at blue katie]$ test.pl
0.02 9.77e-05 100 100181973 9870000000 8.67e+15\n[katie at blue katie]$
In this case, the newline \n was not interpolated but interpreted
literally. Am I to understand you don't get the same results I do?
--
Katie Bechtold
http://katie-and-rob.org/
More information about the Techtalk
mailing list