in reply to Determine first element in foreach
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Determine first element in foreach
by tobyink (Canon) on Aug 04, 2014 at 20:12 UTC | |
by AnomalousMonk (Archbishop) on Aug 04, 2014 at 20:45 UTC | |
by tobyink (Canon) on Aug 05, 2014 at 07:17 UTC |