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

Re: Adding scalars but with a twist..

by TilRMan (Friar)
on Feb 13, 2005 at 18:38 UTC ( #430608=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
            return scalar @$self;
        }
    }
    
  2. or download this
    my ( $a1z, $a2z, $a3z ) = qw( 42 13 666 );
    my @az;
    ...
    for ( 1 .. 3 ) {
        print "\$a${_}z = $az[$_]\n";
    }
    
  3. or download this
    print "\$a0z = $az[0]\n"; 
    # Array index 0 out-of-bounds at bar.pl line 63
    
  4. or download this
    use List::Util qw( sum );
    
    my $sum = sum( @az[ 1 .. 3 ] );
    
    print "sum = $sum\n";
    
  5. or download this
    my $sum = sum( @az );
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2022-05-28 20:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?