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




blnukemAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ozoConnect With a Mentor Commented:
my @Alphabet = ("#", "A".."Z");
0
 
Adam314Commented:
Or if you don't want to change @Alphabet (in case it's used elsewhere)

my @Alphabet = ("A".."Z");
 
print "# ";
foreach my $Letter (@Alphabet) {
print "$Letter ";
}

Open in new window

0
 
ozoCommented:
or
 print "$_ " foreach ('#',@Alphabet);
or
print "# @Alphabet ";
0
All Courses

From novice to tech pro — start learning today.