I was fixing SPR's this morning and ran into a situation where I needed to replace text in a string used to generate a report.
So, I looked at the code, found where it needed to go and added something along these lines:
$_ = $guarantee; s/OldValue/NewSetting/; $guarantee = $_;
(I know it's not the most condensed code, but it fits my current style.)
Not really overly impressive or unusual, but serviceable. Then, I tried to compile the program and ran into all sorts of error messages.
Maybe I was still a little foggy from the early hour (I start at 6:00 am, to avoid the worst of local traffic) and all, but it took me several seconds to realize what I'd done wrong.
You see, the day job pays me to write apps in Borland Delphi, which uses ObjectPascal and contains no built-in support for regular expressions, scalars, $_, or other Perlisms.
I had to laugh...Instead of thinking in Pascal, as I have done for roughly half of my career, I was thinking Perl to work through my Pascal solution. Thanks, y'all.
--fUpdate: Thanks, tilly; I'm glad to hear that. It makes more sense to me, but then I'm only an apprentice. :)
For the rest of you, if you haven't seen that thread or the one it references, I recommend both highly.
Update 2: I should mention that this was this first time I'd run into this with Perl; it's happened with other languages, but not Perl.
In reply to A minor epiphany by footpad
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |