January 2014 Archives

Tech Tip: Opening a file for read/write without clobbering it.

perlopentut gives several options for opening a file for read and write, and I opted to use '+>' for Maniac Downloader, but as it turned out, it caused the existing file to be clobbered (= its length to be set to zero and all of its contents deleted).

After asking on Freenode's #perl channel, we reached this solution …

Tech Tip: Loop Labels in Perl 6

It is known that one can label loops (or arbitrary blocks) in Perl 5, using the syntax of MYLABEL: while (COND()) { BLOCK } or MYLABEL: for my $x (@array) { BLOCK } and then one can do last MYLABEL;, next MYLABEL;, or redo MYLABEL; (for more information see perldoc perlsyn). However, I was unable to find how to do something like that in Perl 6, despite some amo…

About Shlomi Fish

user-pic An Israeli software developer, essayist, and writer, and an enthusiast of open/free software and cultural works. I've been working with Perl since 1996.