Hello all, long time lurker, first time requester...
I have a Perl exam tomorrow and came across a question that I just cannot
find an answer to (past paper, this isn't cheating or homework etc.).
Explain the difference between:
($test)=(@test);
And
$test=@test;
If anybody could shed any
Hi,
you can find the answer here,
http://perlmaven.com/scalar-and-list-context-in-perl
Good Luck to your exam!
On Thu, May 29, 2014 at 1:20 PM, James Kerwin jkerwin2...@gmail.com wrote:
Hello all, long time lurker, first time requester...
I have a Perl exam tomorrow and came across a
On May 29, 2014, at 1:20 PM, James Kerwin wrote:
Hello all, long time lurker, first time requester...
I have a Perl exam tomorrow and came across a question that I just cannot
find an answer to (past paper, this isn't cheating or homework etc.).
Explain the difference between:
On Thu, 29 May 2014 13:36:11 -0700
Jim Gibson jimsgib...@gmail.com wrote:
Try it yourself:
% perl -e '@t=qw(1 2 3);$t=@t;print qq($t\n);'
3
% perl -e '@t=qw(1 2 3);($t)=@t;print qq($t\n);'
1
% perl -e '@t=qw(1 2 3);($t)=(@t);print qq($t\n);'
1
This would be clearer if you used letters:
It seems so obvious now. Should possibly have just tested it myself before
asking...
Thank you all for the explanations!
On 29 May 2014 21:36, Jim Gibson jimsgib...@gmail.com wrote:
On May 29, 2014, at 1:20 PM, James Kerwin wrote:
Hello all, long time lurker, first time requester...
I
On Thu, May 29, 2014 at 3:20 PM, James Kerwin jkerwin2...@gmail.com wrote:
Explain the difference between:
($test)=(@test);
And
$test=@test;
Parens on the left make it a list context, parens on the right make it a
list.
Bare scalar on the left make it scalar context, bare array assigned
I am also a long-time lurker / First time responder, so hopefully I'll
answer acceptably per the email-list conventions...
I will assume that some of the basic references are available to you (or
that others will cite them correctly... as they appear to be doing; many
responses so far.)
On Thu, 29 May 2014 16:27:36 -0500
Steve Kaftanski skaftan...@gmail.com wrote:
Hope this helps! -Steve Kaftanski, MadMongers.org (Madison.pm
Wisconsin).
Here are some links you might find useful:
* official site http://www.perl.org/
* beginners' help
Maybe I'm missing the point but isn't the following code the problem's
answer? Please let me know if I am off base.
Thank you;
Sherman
#!/usr/bin/perl
my @test = a b c;
($test)=(@test);
print \$test: $test\n;
@test = a b c;
$test = @test;
print \$test: $test\n;
# output lines after
On May 29, 2014, at 3:34 PM, Sherman Willden wrote:
Maybe I'm missing the point but isn't the following code the problem's
answer? Please let me know if I am off base.
Just a bit off (see below).
#!/usr/bin/perl
my @test = a b c;
That is a scalar on the right-hand side. You end up with
On Thu, 29 May 2014 16:02:44 -0700
Jim Gibson jimsgib...@gmail.com wrote:
On May 29, 2014, at 3:34 PM, Sherman Willden wrote:
Maybe I'm missing the point but isn't the following code the
problem's answer? Please let me know if I am off base.
Just a bit off (see below).
11 matches
Mail list logo