|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
Perl puzzle of the week/month/year
As promised, here's the new perl puzzle of the week/month/year. This one is short and sweet.
perl Code:
The question here is why does this code run fine, in spite of the use strict; directive? As before, usual rules apply: * I will post the solution on friday, if no one else has got it by then. * First person/people to post the correct answer will have their names on my signature for a while (until I post the next puzzle) * Judge's discretion is final * Keep on truckin'
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by Fishmonger, superior perl programmer of the month Last edited by Scorpions4ever : August 10th, 2009 at 01:08 PM. |
|
#2
|
|||
|
|||
|
$a as well as $b are built-in global vars that are used in sorting and while using them outside of a sort routine is allowed, it's discouraged.
EDIT: maybe I should post the related documentation from perldoc perlvar Quote:
Last edited by FishMonger : August 10th, 2009 at 01:33 PM. |
|
#3
|
||||
|
||||
|
My answer would have been the same as FishMongers. Not sure why you have the -a switch on the shebang line. Might confuse some people trying to answer the question(s) thinking it somehow makes the code fly.
|
|
#4
|
||||
|
||||
|
Fishmonger: That was the correct answer
![]() KevinADC: The -a was a red herring. Originally when I posted the puzzle in my office, I was messing with another predefined var that gets activated with -a, but it didn't work right. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Perl puzzle of the week/month/year |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|