Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

tr operator in eval -- updated

by pgmer6809 (Acolyte)
on Sep 26, 2020 at 02:55 UTC ( #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
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? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2021-06-17 06:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (83 votes). Check out past polls.

    Notices?