Perl/Shell Knowledge Sharing
Perl Interview Questions and Answers
Wednesday, December 29, 2010
To get the index of an array element
my @array = qw(a b b c);
my %hash;
@hash{ @array } = 0..$#array;
print $hash{b}; # 1
SOURCE: http://stackoverflow.com
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment