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

Evil Interview Questions

by kyle (Abbot)
on Feb 08, 2008 at 22:19 UTC ( [id://667087]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $self->foo();
    foo($self);
    
  2. or download this
    package A;
    
    ...
    object B call to bar():
    $self->foo() = B
    foo( $self ) = A
    
  3. or download this
    ($x) = foo();
     $x  = foo();
    
  4. or download this
    my @foo_subs = ( 'sub { return ( 4, 5, 6 ) }',
                     'sub { my @x = ( 4, 5, 6 ); return @x; }',
    ...
    foo = sub { wantarray ? ( 7 ) : 8 }
    ($x) = 7
     $y  = 8
    
  5. or download this
    for ( @x ) { foo( $_ ) }
    map { foo( $_ ) } @x;
    
  6. or download this
    sub foo {
        my $wa = wantarray;
    ...
    map{foo()} @x:
    array
    array
    
  7. or download this
    sub baz { return 11 unless shift }
    
    print 'baz(5): ', baz(5), "\n";
    print 'baz(0): ', baz(0), "\n";
    
  8. or download this
    baz(5): 5
    baz(0): 11
    
  9. or download this
    my $FOO = 'foo';
    sub bar { $_[0] = 'bar' }
    ...
    print $FOO, "\n";
    print bar( $FOO ), "\n";
    print $FOO, "\n";
    
  10. or download this
    foo
    bar
    bar
    
  11. or download this
    for my $s ( qw( a b c ) ) { $s =~ s/$/\n/ && print $s }
    
  12. or download this
    Modification of a read-only value attempted at interview.pl line
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://667087]
Approved by moritz
Front-paged by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-03-29 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found