Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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';


Comment on Re: what's this loo code?
Download Code
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 about the Monastery: (9)
As of 2014-10-01 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (391 votes), past polls