Other journalers seem to have weekly quizzes, so here is my take on that. The first "Show brian he's a dumbass" question of the week:
If you can see the problem in less than five minutes, you are better than me.
print "$ARGV[$.] $_";
Bonus: Identify what I wanted to happen.
Double Bonus: Identify the line that came before this line.
Platinum Bonus: Identify the line that came after it.
Global Thermonuclear War Bonus: How many Perl special variables directly influence, or are influenced by, the intended operation?
Comments are enabled, no googling, no asking your dog, no nothing. Go!
I'll take a stab at it (Score:2)
2) off the cuff guess:
while ( <> ) {
3) }
4) Hmmm. , $/, @ARGV...that's all I can quickly dig up. So 3.
Does reading your previous entry count against me? I'm guessin' this is related to line counting.
I know I'm mostly wrong but it was fun to read perlvar again to see how far off I was.
Re:I'll take a stab at it (Score:1)
2) Yes, the preceding line was while(){. Bonus points awarded.
3) Nope. Platinum points still available.
4) The Global Thermonuclear War points are still available.
5) Actually, this is unrelated to my post on line counting. It comes from another program I was working on today.
Re: What's wrong with this line of Perl? (Score:1)
open(IN, $ARGV[0]) or die "$ARGV[0]: $!";while ( <IN> ) {
print "$ARGV[$.] $_\n";
}
What I'm pondering while looking at this, and without virtue of perlvar, is whether there'
Re: What's wrong with this line of Perl? (Score:1)
Re: What's wrong with this line of Perl? (Score:1)
2) Bonus points already awarded to gizmo_mathboy. The preceding line used the diamond operator <> which I forgot to entity encode in my last response.
3) Platinum and Global Thermonuclear War points still av
Re: What's wrong with this line of Perl? (Score:1)
For GTW, @ARGV, $ARGV, $., and $_
Re: What's wrong with this line of Perl? (Score:1)
Re: What's wrong with this line of Perl? (Score:1)
For question 5: $/ and $\ would directly influence the operation. I don't think that any special variables are affected by it (apart from the stringification of $..
Re: What's wrong with this line of Perl? (Score:1)
RE: What's wrong with this line of Perl? (Score:1)
Re: What's wrong with this line of Perl? (Score:1)
Line after (Score:1)
close ARGV if eof;Another way to say what you meant:
I don't care for backslashes much if I can help it
Re:Line after (Score:1)
Maybe it is time for another hint: it is nothing tricky or unusual.
Global Thermonuclear attempt (Score:1)
$ARGV, @ARGV, *ARGV (or does that just count as 1 since you can get to them all through *ARGV?), $_, $.So, 5?
Re:Global Thermonuclear attempt (Score:1)
One more stab at it (Score:1)
(Actually, I bet you really have a blank line before the while loop, but that you're not being that evil in the nature of your question.)
Global Thermonuclear War Bonus:
Re:One more stab at it (Score:1)
Global Thermonuclear War bonus: i think that is pretty close---I had not actually considered $|. Still, at least one is missing.
Re:One more stab at it (Score:1)
Re:One more stab at it (Score:1)