Thanks.

Is this better?

print "$first, $second, $third","\n";

255, 255, 255
765

If I put the second set of quotes after the last comma, I get an error.

I am only on pg 21 of Learning Perl 5th ed. I am trying as many variations of 
the examples just to mess around and see what happens with different characters.


Mike Grove | AIX System Administrator
OIT - BIO - Server Farms Division
PA Department of Labor & Industry
651 Boas Street Room 124 | Harrisburg, PA 17121
Phone: 717-705-2724 | Fax: 717-783-6364
AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502





-----Original Message-----
From: Shlomi Fish [mailto:shlo...@iglu.org.il]
Sent: Wednesday, January 06, 2010 12:45 PM
To: beginners@perl.org
Cc: Grove, Michael
Subject: Re: double quotes are needed

Hi Mike!

On Wednesday 06 Jan 2010 19:27:59 Grove, Michael wrote:
> Can someone tell me why I need double quotes for this to work at the line
>  with: print $first, $second, $third\n;
>
> #!/usr/bin/perl -w
>

Don't use "-w". Add "use strict;" and "use warnings;". Then fix the errors.


> $first = 0xFF;
> $second = 0377;
> $third = 0b11111111;
> print $first, $second, $third\n;

$third\n is invalid code. The "\n" must be placed inside a string.

Regards,

        Shlomi Fish

> $answer = $first + $second + $third;
> print "$answer\n";
>
> It only gives this output when I write double quotes "print $first,
>  $second, $third\n";
>
> 255, 255, 255
> 765
>
>
> Mike Grove | AIX System Administrator
> OIT - BIO - Server Farms Division
> PA Department of Labor & Industry
> 651 Boas Street Room 124 | Harrisburg, PA 17121
> Phone: 717-705-2724 | Fax: 717-783-6364
> AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502
>

--
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Interview with Ben Collins-Sussman - http://shlom.in/sussman

Bzr is slower than Subversion in combination with Sourceforge.
( By: http://dazjorz.com/ )

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to