Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: what's this loo code?

by pfaut (Priest)
on Feb 04, 2003 at 17:49 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-23 11:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found