apl has asked for the wisdom of the Perl Monks concerning the following question:
I realize if I was using an array (rather than an array reference) I could use $#name or scalar( @Name ).use strict; my @Header = ( 'Record Type ', 'File Generation Date/Time ', 'Origin ', ); my @New; my @Trailer; my %Classes = ( 'NW' => { labels => \@New }, 'HD' => { labels => \@Header }, 'TR' => { labels => \@Trailer }, ); my $type = 'HD'; Display( $Classes{ $type }->{labels} ); sub Display { my ( $Labels ) = @_; my $count = scalar( $Labels ); ### I know this doesn't work. print sprintf( "Display: %d '%s'\n", $count, $Labels->[1] ); }
|
|---|