print while($_=<>)!=42
Any golfers want to show me how it's really done?
created
last reply
- 6
replies
- 1.5k
views
- 6
users
print while($_=<>)!=42
Any golfers want to show me how it's really done?
I submitted my answer but it failed to recognize it as a correct answer, despite it saying it was correct at ideaone.com. I assume it may be because of the perl version I am using (5.10) versus the ones available in the drop down (5.20 and 6). If anyone can take a look and see if there is anything I am missing, it would be greatly appreciated.
my @numbers = ("1","2","88","42","99");
foreach (@numbers){
if ($_ !=42) {
print $_."\n";
}
else {
exit;
}
}