in reply to Strange compile error?

my $N= #Org;

If you want to get the length of the array do:

my $N = scalar( @Org );

You may have been thinking of:

my $N = $#Org;

Which gives you the index of the last element, probably not what you're looking for.

Replies are listed 'Best First'.
Re^2: Strange compile error?
by LanX (Saint) on Apr 29, 2024 at 17:27 UTC
    > my $N = scalar( @Org );

    That's explicit and correct, tho for completeness

    my $N = @Org;

    has the same implicit effect, since it's a scalar assignment. (The left hand side is a scalar)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery