Perl use split and remove specific character

i want to split the input by a space and remove specific characters like full stop, comma...... etc. and then save each word in an array.
i got something below, but it didn't work. can anyone please help me?
Thank you

#!/usr/bin/perl -w

while (<>) 
{
	$line = <>;
	@word = split(' ', $line);
	$line =~ s/[^\w]/ /g;
	@lowerword = map {lc($_)}@word;
	print(@lowerword);
}

Input: Hello. How are you?
Output: hello how are you

You haven't mentioned if you want to change the case as well; I'm assuming you do (as per the output).

$
$ cat splitrem.pl
#!/usr/bin/perl -w
while (<>) {
  $line = $_;
  print "Input  : ",$line;
  $line =~ s/[[:punct:]]//g;
  $line = lc($line);
  @word = split(' ', $line);
  print "Output : ",join(" ",@word);
  print "\n";
}

$
$ echo "Hello, how are you?" | perl splitrem.pl
Input  : Hello, how are you?
Output : hello how are you
$

HTH,
tyler_durden

As a oneliner:

% perl -E'say lc join "-",shift=~/(\w+)/g' 'Hello. How are you?'
hello-how-are-you

For older versions:

perl -le'print lc join "-",shift=~/(\w+)/g'

Thank you, it is working.

i have try yours, it is working, but mine is not working....

#!/usr/bin/perl -w

while (<>) 
{
	$line = $_;
  	$line =~ s/[[:punct:]]//g;
  	$line = lc($line);
 	@word = split(' ', $line);
	print (@word);
}

Input : Hello, how are you?
Output : hellohowareyou

i don't know why my output is sticking together? i want it to separate.... can anyone help?
Thank you

You missed the join function.

because you are printing the array, (the parenthisis are extra garbage not needed in your code):

print (@word);

you can use join() to print it as a string with any delimeter between the array elements, but if all you want is a single space you can simply double-quote the array which pefroms a bit of magic and converts the array into a string and adds a space between the elements:

print "@word";