Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #!/usr/bin/env perl6
  2. use v6;
  3.  
  4. my $foo = 'switch';
  5. my $t1 = my $t2 = my $t3 = my $t4 = 'this has a $foo in it';
  6.  
  7. my $replace = prompt( ':' ); # $0
  8.  
  9. $t1.=subst( / ( $ w+ ) /, $replace );
  10. $t2.=subst( / ( $ w+ ) /, { $replace } );
  11. $t3.=subst( / ( $ w+ ) /, { $replace.EVAL } );
  12. $t4.=subst( / ( $ w+ ) /, { ( $replace.EVAL ).EVAL } );
  13.  
  14. say "T1 : $t1";
  15. say "T2 : $t2";
  16. say "T3 : $t3";
  17. say "T4 : $t4";
  18.  
  19. # T1 : this has a $0 in it
  20. # T2 : this has a $0 in it
  21. # T3 : this has a $foo in it
  22. # T4 : this has a switch in it
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement