Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: chomp each element of array

by Laurent_R (Monsignor)
on Jun 10, 2013 at 12:38 UTC ( #1038056=note: print w/ replies, xml ) Need Help??


in reply to Re: chomp each element of array
in thread chomp each element of array

the array is evaluated in a list context.

Huh, it sounds a bit like a tautology, doesn't it? (Even though an array may be evaluated in a scalar context and return in this case the number of elements.)

I would rather say that the array is imposing a list context and that the chomp operator is used in a list context in this case. And, in such a case, it chomps all the elements of the list (and returns the total number of characters removed)

Note that if used on a hash, it chomps the hash's values, but not its keys.


Comment on Re^2: chomp each element of array
Replies are listed 'Best First'.
Re^3: chomp each element of array
by LanX (Canon) on Jun 10, 2013 at 16:23 UTC
    > I would rather say that the array is imposing a list context and that the chomp operator is used in a list context in this case.

    nope, you're wrong. the operator chomp imposes the context, thats how scalar @array works.

    I think @array can only impose list context as LHS of =, which becomes a list-assignment operator then.

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2015-07-28 10:04 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 (254 votes), past polls