Hi Randal,

On Thu, 25 Aug 2011 11:41:34 -0700
mer...@stonehenge.com (Randal L. Schwartz) wrote:

> >>>>> "Shlomi" == Shlomi Fish <shlo...@shlomifish.org> writes:
> 
> Shlomi> Well, I believe I've always avoided using an implicit $_ as
> Shlomi> preventative measure (out of thinking I know better) and so cannot
> Shlomi> present such a case first-hand. However, see:
> 
> Shlomi> http://www.forum2.org/gaal/perl/Pitfall/slide001.html - “A $_
> Shlomi> Gotcha”.
> 
> Ahh, so the break was *someone else's* code, not the coder's fault.
> 

Well, it affected the coder, because they were dependant on using $_.

> At that level, anything can go wrong... we can't code completely
> defensively presuming everything else is idiotic.

Well, coding defensively is a good idea within reason. 

> So I'm still wondering why you have excessive paranoia about *your* code
> accidentally breaking $_.  How did *you* get burned "accidentally" as
> you claim?
> 

Where do you see that you claim that I got burned accidentally?

> If not, please stop suggesting that other people change their behavior
> when using $_ *as designed* is a perfectly acceptable practice.  It
> makes Perl seem scarier than it is.  (A lot of those PBPs are like that,
> but I won't open that can of worms here.)

If you want to use $_ so be it, but it can easily introduce subtle errors into
your code, because $_ is so easy to modify and clobber. So I would recommend
against these, and still think it's a good idea.

> 
> print "Just another Perl hacker,"; # the original
> 

Well, the text here may not be displayed on the shell (or displayed on the same
line as the following prompt.). :-)

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
The Case for File Swapping - http://shlom.in/file-swap

COBOL is the old Java.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to