2007/7/10, Martin Barth <[EMAIL PROTECTED]>:
for (@startingdeck) {
s/A/Ace/;
s/K/King/;
s/Q/Queen/;
s/J/Jack/;
s/C/Club/;
s/H/Heart/;
s/D/Diamond/;
s/S/Spade/;
# s/J/Joker/; ##makes no sense, since j <- jack
}
Instead of multi-regex here,I think using a
HTH,
% perl test.pl
4 Diamond 9 Club 3 Spade Ace Spade 8 Diamond
% cat test.pl
#!/usr/bin/perl
use strict;
use warnings;
my @startingdeck = ("A H","2 H","3 H","4 H","5 H","6 H","7 H","8 H",
"9 H","10 H","J H","Q H","K H",
"A D","2 D","3 D","4 D","5 D","6
On Jul 9, 4:36 am, [EMAIL PROTECTED] (Amichai Teumim) wrote:
> In my deck of cards I want to replace the letter of the card with the name(
> e.g. A = Ace).
>
> So I tried to implement the following snippet into my code:
>
> while @startingdeck{
> $_ =~ s/A/Ace/;
> print NEW;
>
> }
> Is the lo
--- Begin Message ---
Hi Martin
This changes the names, but bring horrible results:
shift(@startingdeck),
pop(@startingdeck),
shift(@startingdeck),
pop(@startingdeck),
shift(@startingdeck),
pop(@startingdeck)
2007/7/9, Amichai Teumim <[EMAIL PROTECTED]>:
Hi
In my deck of cards I want to replace the letter of the card with the name(
e.g. A = Ace).
You can also use a map to do this.ig,
use strict;
use warnings;
my @startingdeck = ("A H","2 H","3 H","4 H","5 H","6 H","7 H","8 H",
"9 H
Hi
In my deck of cards I want to replace the letter of the card with the name(
e.g. A = Ace).
So I tried to implement the following snippet into my code:
while @startingdeck{
$_ =~ s/A/Ace/;
print NEW;
}
The code is as follows (including snippet):
#!/usr/bin/perl
use strict;
use warnings;