$|=1; # So it works in the IDE
use v5.10.1; # so we can use say

@a = qw /Joe Sue Jane Bill Bob Ann Jerry/;

say "How many elements do you want?";
$x = <STDIN>; # The number of elements to slice
chomp $x;

$s = @a; # get the size of the array (array in scalar context)
$x = $s if $x > $s; # reduce to maximum size if too large

$x--; # adjust for index numbers starting at 0
@b = @a[0..$x]; # get the range

say for (@b); # Check if we have sliced properly
say "End of array";
