Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Answer: How do I find the size of an array?

by VinsWorldcom (Prior)
on Feb 09, 2010 at 21:02 UTC ( [id://822278]=note: print w/replies, xml ) Need Help??


in reply to Re: How do I find the size of an array?
in thread How do I find the size of an array?

What's wrong with:

$length = @array;

For example:

#!/usr/bin/perl use strict; my @array = qw(one two three); my $length = $#array + 1; print "Dollar pound array = $length\n"; $length = @array; print "At symbol array = $length\n"; __DATA__ {C} > test.pl Dollar pound array = 3 At symbol array = 3

Replies are listed 'Best First'.
Re^2: Answer: How do I find the size of an array?
by merlyn (Sage) on Feb 10, 2010 at 00:53 UTC
    What's wrong with:
    $length = @array;
    Nothing. TIMTOWTDI.

    -- Randal L. Schwartz, Perl hacker

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-19 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found