Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How's your Perl?

by ambrus (Abbot)
on Nov 02, 2003 at 16:47 UTC ( #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}

3.

# 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});

4.

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.

8.

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

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2023-12-11 16:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (41 votes). Check out past polls.

    Notices?