- or download this
# Access directly the last element of the array
sub queryDBI {
...
return $query1;
}
print queryDBI(qw/first second third fourth fifth_and_last/),$/ x 2'
- or download this
# In scalar context, @array returns the number of elements in contains
+.
# As @array indexes start at 0 (unless someone explicitly changes this
+ through $[), we substract 1
...
return $query1;
}
print queryDBI(qw/first second third fourth fifth_and_last/),$/ x 2'
- or download this
# $#array returns the index of the last element of the array.
sub queryDBI {
...
return $query1;
}
print queryDBI(qw/first second third fourth fifth_and_last/),$/ x 2'