Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: what's this loo code?

by pfaut (Priest)
on Feb 04, 2003 at 17:49 UTC ( #232605=note: print w/replies, xml ) Need Help??

in reply to what's this loo code?

I think whatever perl normally uses $= for is irrelevant. The idea is to use the assignment to a scalar to evaluate the array in scalar context. The anonymous array exists to evaluate the <> in list context. So, slurp the file into the anonymous array, then assign the size of the array to $= and print it.

--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';

Replies are listed 'Best First'.
Re: Re: what's this loo code?
by ihb (Deacon) on Feb 04, 2003 at 17:59 UTC
    This is a bogus explanation I'm afraid. The anonymous array you speak of doesn't exist afaik, but I wouldn't bet my life on it. But what I'm sure of is that then assign the size of the array to $= is wrong. From perlop: "a list assignment in scalar context returns the number of elements produced by the expression on the right hand side of the assignment." What's on the LHS is irrelevant.   print scalar(($a, $b) = ('a','b','c')); # prints '3' ihb

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2021-01-17 01:19 GMT
Find Nodes?
    Voting Booth?