Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

tr operator in eval -- updated

by pgmer6809 (Sexton)
on Sep 26, 2020 at 02:55 UTC ( [id://11122227]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        $kards = -99;
        $bad="AKQJT98765432KKKK";
    ...
    Num of K in AKQJT98765432KKKK = 0 
    Num of K in AKQJT98765432KKKK is = 5 
    =end
    
  2. or download this
        $kards = -99;
        $bad="AKQJT98765432KKKK";
        $card='K';
    ...
        $kards = eval "$bad =~ tr/$card//;";    #<====== Note the ; " ; at
    + the end. This seems required.
            print "xtr kards = $kards from eval cmd : $xtr\n";
        #output: xtr kards = 5 from eval cmd : AKQJT98765432KKKK =~ tr/K//
    +;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11122227]
Approved by Athanasius
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-23 17:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found