use strict; my $rest = 'a b c d password'; my @rest = split(/ /, $rest); print "\@rest=@rest\n"; my $apass = pop @rest; print "PASS: $apass\n"; print "\@rest=@rest\n"; #### @rest=a b c d password PASS: password @rest=a b c d