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

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2016-06-30 04:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (389 votes). Check out past polls.