Hi,
It should all be indented if you did it right :) (which it isn't). Could be your code isn't indented in Notepad?
Anyway, to answer your question:
this is basically looking at each value of @players, and checking if the value matched $name. Its a shorthand way of doing something like:
if ($_ eq $name) {
print "its a match!"
}
}
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
It should all be indented if you did it right :) (which it isn't). Could be your code isn't indented in Notepad?
Anyway, to answer your question:
Code:
if (grep {$_ eq $name} @players) {this is basically looking at each value of @players, and checking if the value matched $name. Its a shorthand way of doing something like:
Code:
foreach (@players) { if ($_ eq $name) {
print "its a match!"
}
}
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!