Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Change variable multiple times within a single string?

by 2teez (Priest)
on Apr 27, 2013 at 18:09 UTC ( #1030995=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Change variable multiple times within a single string?
in thread Change variable multiple times within a single string?

~ Printing the variable in each line is only showing the current value..

That is excatly my point. Since, what to print when '1' is seen is not known, I think is better to leave it out.
Your output:

A (yes) 1 (yes) #? 1 (yes) #? 1 (yes) #? B (no) 1 (no) #? 1 (no) #? 1 (no) #? A (yes) 1 (yes) #? 1 (yes) #? 1 (yes) #? B (no) 1 (no) #? 1 (no) #? 1 (no) #?
Output with a little modification:
A (yes) B (no) A (yes) B (no)
OR one can provide for '1' in hash like so:
my %decision = ( A => 'yes', B=> 'no', '1'=>'', );
Then the output shows:
A (yes) 1 () 1 () 1 () B (no) 1 () 1 () 1 () A (yes) 1 () 1 () 1 () B (no) 1 () 1 () 1 ()
Just saying.....

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


Comment on Re^4: Change variable multiple times within a single string?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030995]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2015-07-03 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (53 votes), past polls