Loading ...
Sorry, an error occurred while loading the content.
 

Re: [PBML] translation does not work

Expand Messages
  • Lou Hernsen
    well i finally got it to work.. Lou ... From: acummingsus To: perl-beginner@yahoogroups.com Sent: Wednesday, December 28, 2005 9:26 PM Subject: Re: [PBML]
    Message 1 of 5 , Dec 29, 2005
      well i finally got it to work..
      Lou
      ----- Original Message -----
      From: acummingsus
      To: perl-beginner@yahoogroups.com
      Sent: Wednesday, December 28, 2005 9:26 PM
      Subject: Re: [PBML] translation does not work


      --- In perl-beginner@yahoogroups.com, "Lou Hernsen"
      <lhernsen1015@w...> wrote:
      [ . . ]
      > $value="123-456-7890";
      > $value =~ tr/0123456789/0123456789/d;
      > Now the result should be
      > 1234567890

      Should it be?

      I don't know that much about it. I don't know when to use
      transliterate versus the substitution operator instead.

      If you mean to have a num (I assume not since you quoted the
      assignment to $value) then the - (given num) is the subtraction operator.

      But here, (just for why_not) I experimented a bit:

      #!/usr/bin/perl -w
      use strict;
      use diagnostics;
      my $num=123_456_7890; # not a string (I think)
      my $string = '123_456_7890'; # ' or " is string
      print $num, "\n";
      $num =~ tr/0123456789/0123456789/d;
      #$value =~ tr/-//d;
      print $num, "\n";

      print $string, "\n";
      $string =~ tr/0123456789/0123456789/d;
      #$value =~ tr/-//d;
      print $string, "\n";
      $string =~ tr/_//d;
      print $string, "\n";
      # end

      --
      Alan.






      Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html



      ------------------------------------------------------------------------------
      YAHOO! GROUPS LINKS

      a.. Visit your group "perl-beginner" on the web.

      b.. To unsubscribe from this group, send an email to:
      perl-beginner-unsubscribe@yahoogroups.com

      c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


      ------------------------------------------------------------------------------



      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.