blnukem
asked on
print # sign with alphabet array
Hi All
I use this code to dynamically print the alphabet:
my @Alphabet = ("A".."Z");
foreach my $Letter (@Alphabet) {
print "$Letter ";
}
RESULT: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
How do I add the # in the array in front of the "A"
DESIRED RESULT: # A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
I use this code to dynamically print the alphabet:
my @Alphabet = ("A".."Z");
foreach my $Letter (@Alphabet) {
print "$Letter ";
}
RESULT: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
How do I add the # in the array in front of the "A"
DESIRED RESULT: # A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
or
print "$_ " foreach ('#',@Alphabet);
or
print "# @Alphabet ";
print "$_ " foreach ('#',@Alphabet);
or
print "# @Alphabet ";
Open in new window