in reply to Help with split() function

I believe what you are trying to do is print out all words in which a p or P is surrounded by other letters. Using \w in the regular expression will actually grab numbers as well as letters, so I'll assume it is ok to grab "words" with numbers in them. You are on the right track using split and splitting your lines on whitespace. I think where you might be confused is that split creates a list (or array) of "words", which I will generalize and call "tokens". Once you do the split, you want to loop through all your tokens and print those which match your regex condition.
#!/usr/bin/env perl use warnings; use strict; my $filename = shift; open my $test_fh, '<', $filename or die "Can not open file $filename: +$!\n"; while (<$test_fh>) { my @tokens = split; for my $token (@tokens) { if ($token =~ /\wp\w/i) { print $token, "\n" } } } close ($test_fh);

Prints out:

CPAN comprehensive expression. operator.

Please also note that I got rid of the @ARGV in the open line. While it is legal to do so, it is not usually done that way since @ARGV may contain several items, but open will only accept one filename. Please read about shift to understand what's going on there.