in reply to possible wierdness from "for @array"

Your loop is ending prematurely because you are modifying the array over which you are iterating.

You also have an off by one error.
my @range = '1' .. $#lines;
should be
my @range = 0 .. $#lines;

The "$#lines -" is pointless.
$lines[ $#lines - splice(...) ]
can be replaced.
$lines[ splice(...) ]

Finally, the use of splice can be replaced with a more efficient swap and pop.

Or you could just use shuffle from List::Util.
my @blah = shuffle @lines;