On Jul 23, Chuck Roberts said:

>$a[0]="$1,234.05";

Oops!  Double quotes make $1 a scalar variable, and Perl interpolates its
value into your string; specifically, $1 is probably "" at this point.

>$a[1]="1234.78";
>$a[2]="$768";

Again, $768 is a variable whose value is (hopefully) "".

>$a[3]="777.99";

Consider using single quoted strings instead:

  @a = (
    '$1,234.05',
    '1234.78',
  );

or:

  @a = qw(
    $1,234.05
    1234.78
  );

In addition, the actual function can simply be:

  sub demonify {
    my $str = shift;
    $str =~ tr/,$//d;  # remove all ,'s and $'s
    return $str;
  }

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to