[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [Fun With Perl] Idiom misuse (typos can getcha)



On Thu, Jun 10, 1999 at 06:22:36PM -0400, Bernie Cosell wrote:
> On 10 Jun 99, at 14:00, Vicki Brown wrote:
> 
> [...]
> >     open(FH, ">$file") or die;
> > 
> > 
> > # oops; that ran awfully fast ;^)
> 
> AHA!  A perl analog to the "rm -r * ~" Unix gotcha...
>                                    ^ whoops on that space...
> 

One of my coworkers was in the process of learning Perl.  He needed a
script that would loop over all his files, and perform some simple
operations.  He found an example in one of his books (probably a camel or
llama) that showed how to delete files, with a loop using unlink().

That looked a lot like what he wanted to do, so he copied the code, and
added in the bits he needed for what he was doing.

Unfortunately, not being familiar with the unlink() function, he left that
part of the code intact.

Soon after, he was in the IS department complaining that all his files had
"disappeared".  We all had a good laugh when we realized why.


Ronald

==== Want to unsubscribe from this list? (Don't you love us anymore?)
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org