If I write for my $file in (@files) { ... } one more time, I'm gonna scream. That's all.
IT'S STUCK IN MY FINGERS. MY FINGERS ARE SCREAMING!
Do you have any "non-perlisms" that you can't help but type?
Somehow, and surprisingly, none of the iterator type modules I saw in a quick CPAN seach do the trick with less finger pain. But there's always the option of $_ if you don't need the lexical:
for ( @files ) {
# stuff
}
For small scopes, I find I often revert to single letters.
for my $f in ( @files ) {
...
}
--dagolden
Re:iterators?
bart on 2008-12-13T11:20:38
You said "in". *giggle*Re:iterators?
dagolden on 2008-12-13T12:54:28
Yeah.
:-( I "got it" after I posted my reply and didn't even see it in my copy/paste.
-- dagolden
After doing some java coding, I often get compilation errors in perl because I forget the $ in front of a variable
Nothing that a few wtf's can fix...
public ovid foo() {
// ...
}
:-)
Re:Culture shock
Ovid on 2008-12-12T16:19:40
Ovid's foo should be private, thank you.
Re:Culture shock
ziggy on 2008-12-12T17:40:17
I think you misread that. Anyone can askfoo()
for anovid
.:-) Re:Culture shock
chromatic on 2008-12-12T19:45:03
What does it return in
ovid
context?Re:Culture shock
ziggy on 2008-12-12T20:24:26
What does it return in
ovid
context?It always returns
ovid
in anovid
context. In a strongly typed language, the compiler will never allow you to call it from a non-ovid
context. I suppose you could overloadfoo()
to return avirgil
,horace
, or evenhomer
in other contexts, but I've never needed to do that.Re:Culture shock
chromatic on 2008-12-12T20:42:58
If any dead Greek poet were polymorphic, I would have thought
ovid
!Re:Culture shock
Ovid on 2008-12-13T12:16:45
He was considered a Roman poet, actually. Had Roman citizenship until he died, though he was never permitted to return to Rome after he was relegated (a form of exile).
I have started adding the "in" also.
I also wrote this once:
my @list = for $i in @source when $i > 42 collect "OH, $i";
It turns out that Perl can't parse that