I'm working on a project where I need to take an input from the user and then cut it up into its individual characters for later use (to shift them up one character) but I'm having trouble getting the input into an array and printing it out to check that its in there. Currently my code is
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my $count=0; # this block just creates variables
my $userinput;
print "Input?";
$userinput=<STDIN>; # this block just gets input and creates the array
my @userarray=();
while(<@userarray>) {
@userarray = split('', $userinput); #this block should loop as many times as there are characters in the input while separating the characters
}
print Dumper(@userarray); #this should print the array
My output should look some like this if their input is "house"
@userarray[0]= "h"
@userarray[1]= "o"
@userarray[2]= "u"
@userarray[3]= "s"
@userarray[4]= "e"
But when I do enter something in it just print back a blank screen despite strict and warnings not coming back with anything. Where did I go wrong?