Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: How's your Perl?

by ambrus (Abbot)
on Nov 02, 2003 at 16:47 UTC ( [id://303927]=note: print w/replies, xml ) Need Help??

in reply to How's your Perl?

I could solve 5 of them.

1. *x=*_;&{sub{$x[0]="kacsa\n";print$x[1]}}($a,$a);

2. {foo;redo}


# lvalue subroutines are EXPERIMENTAL (a); $foo="a";sub a:lvalue{$a[1]};@a=(19,85); print \$foo->[1] == \$foo->(1), $/; # Pseudo-hashes are DEPRECATED (b); $foo=[{1,1},"kacsa"];$\=$/; print (\$foo->[1]); print (\$foo->{1} +); print (\$foo->[1] == \$foo->{1});


dump;; # But that may change in future versions. I don't know any solution # not using the function dump; kill 5,0 is too long.

6. $u="kacsa";$x=\$u;$y="$x";$\=$,=$/;print $x,$y,$$x,$$y,$x eq $y,$$x eq $$y;

7. I can't even make !*$foo true.


# Why does changing $foo fail silently? I don't quite understand. # It works in perl5.{00503,6.1,8.0,8.1} *foo=*[;print(($foo^=0)++ eq $foo++,$/);

UPDATE: read some solutions. So you accept mine for 3 and 4. Quiestion 10 is really trickey.

UPDATE: please someone explain why my solution to 8 works. I don't understand. Thx.

UPDATE: I still don't know how my solution to 8 works, I've found it accidentally, but I see that there's a similar solution using $^N. (And one even with $1, wow!) (The official solution which uses $| is eaasier to understand.)

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-04-22 09:06 GMT
Find Nodes?
    Voting Booth?

    No recent polls found