The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

Browse by Tags

All Tags » Perl (RSS)
  • Re: "Creative" coding

    [quote user="Ren"]From man regex: "To include a literal '-', make it the first or last character, or the second endpoint of a range." [/quote] What do POSIX regex functions have to do with .NET ones? [quote user="Ren"] ~$ perl -e '$_ = "-"; print "x...
    Posted to Forum by Spectre on 09-26-2008
  • Re: Zero based indexing gone too far

    [quote user="morbiuswilters"]I really hate zero-based indexing. Can't we move on beyond this?[/quote] $[++;
    Posted to Forum by Faxmachinen on 06-26-2008
  • Re: Optimistic Optimisation

    [quote]have a website designed in Perl based on LAMP architecture[/quote] and I always thought the P in LAMP stands for PHP. learned something new today
    Posted to Forum by salandur on 02-21-2008
  • Re: Speed Challenge 37 - ITT We Consider Word Scrambles

    too_many_usernames: flop: #!/usr/bin/perl # one word per line, at least 4 characters in a word. $dupl=$count=0; %ana=(); while (<>) { @chars=sort m#(\l[a-z])#gi; next unless @chars>=4; $dupl++ if (++$ana{join("",@chars)}) >1; $count++; } printf "Of %d words %d duplicate anagrams (%5.2f%%...
    Posted to Forum by ohcamacj on 09-26-2007
  • Re: AI challenge - number sequences

    tster: On a related note, 4 is the magic number. Do you know why? because 4 is 4 is 4 is 4! No other number possesses this property! for instance: 10 is 3 is 5 is 4. 11 is 6 is 3 is 5 is 4. in fact, 193 is 21 is 9 is 4. Go figure! write a program to figure out why 4 is the magic number. Sure. #!/usr...
    Posted to Forum by ohcamacj on 09-13-2007
  • Re: Checking for the existence of... something.

    makomk: $r->finfo; I suspect the author expected this to set the "last stat buffer" used by the -e _ and -r _ expressions, but from the documentation (I didn't bother testing it, so I could be wrong) it looks as though the finfo method uses some special Apache thingy, not Perl's normal stat builtin...
    Posted to Forum by iwpg on 08-28-2007
  • Re: Is this monomorphism?

    Hmm... -e is an operator, not a function. The guy could have created the function so that he could use it in later HOFs, but probably not. :) I agree that the -e thing is weird. I personally think that Larry should have made an effort to eliminate every conceivable feature of Perl 5 that would leave...
    Posted to Forum by quamaretto on 08-17-2007
  • Is this monomorphism?

    Some lovely perl code I inherited. This might seem like a minor offense, but I've got 50K lines of code written by this guy and it is all this ugly. sub fexists { my $fil = shift; if(-e $fil) { return 1; } return 0; }
    Posted to Forum by jigjig on 08-17-2007
  • Re: A few interview questions

    ...and the boring but reasonably efficient version, just for the record: sub is_balanced($) { my @stack; foreach my $c (split(//, shift)) { if (@stack && $stack[$#stack] eq $c) { pop(@stack); } else { push(@stack, {'('=>')','['=>']','{'=>'}'}->{$c} || ""); } } @stack == 0; } print...
    Posted to Forum by iwpg on 08-01-2007
  • Re: A few interview questions

    Number 3: sub is_balanced($) { my $s = shift; while ($s =~ s,\(\)|\[\]|\{\},,g) {} length $s == 0; } print is_balanced "()", "\n"; print is_balanced "()[]", "\n"; print is_balanced "({{[]}})", "\n"; print is_balanced "(]", "\n"; print is_balanced "([)]", "\n"; print is_balanced "{{{{", "\n";
    Posted to Forum by iwpg on 08-01-2007
Page 1 of 3 (25 items) 1 2 3 Next >
Powered by Community Server (Non-Commercial Edition), by Telligent Systems