You can use a for loop instead of foreach
for ($i = 0; $i < $#mylist ; $i++) { say "first element" if ( $i == 0 ); }
Neil Watson
watson-wilson.ca
In reply to Re: Determine first element in foreach
by neilwatson
in thread Determine first element in foreach
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |