PERL - seperate each letter of a $var and make array?

zink66

New Member
I'm attempting to use STDIN to get a phone number, i.e. 5554567 and I want to seperate that into different parts of an array, i.e. @array[0] = "5", @array[1] = "5", etc... So that I can use them. How do I do this?:confused:
 
I can't imagine why you'd want to do it, but this should work:
Code:
my $number=<STDIN>;
my @array=split(undef,$number);
 
Back
Top