in reply to Regex EOF

You don't need \s
use warnings; use strict; use Data::Dumper; my $line = 'hello world'; my @words = ($line =~ m/[a-zA-Z0-9]+/g); print Dumper(\@words); __END__ $VAR1 = [ 'hello', 'world' ];
Please read: Writeup Formatting Tips