in reply to help with (what I consider) a strange problem

You are assigning the return value of chomp() to $_ ... and chomp() returns whatever it chomped off the end of the string, not the chomped string.

updateMy bad ... chomp() returns the number of characters chomped off --- it seems Text::Bastardize has a problem with digits and hangs, at least that's what I get with this example:

#!/usr/bin/perl -w use strict; use Text::Bastardize; my $latin = Text::Bastardize->new(); $latin->charge('blah 10 '); print $latin->pig(),"\n"

seems like a bug in Bastardize to me.

Replies are listed 'Best First'.
Re: Re: help with (what I consider) a strange problem
by sachmet (Scribe) on Mar 19, 2001 at 07:26 UTC
    Nope... chomp returns number of chars chopped. So:
    $t = "t\n"; $num = chomp($t); print "$num"
    prints "1", whereas:
    $t = "t"; $num = chomp($t); print "$num"
    prints "", whereas:
    @t = ("t\n","u\n","v","w\n"); $num = chomp(@t); print "$num";

    prints "3".

    (edited: error in my code fixed)