#!/usr/bin/perl -w use strict; while (<DATA>) { my @line = split (); foreach my $word (@line) { if ($word =~ /P/i) { print "$word\n"; } } } __DATA__ CPAN stands for comprehensive Perl Archive Network. ^ and $ are used as anchors in a regular expression. /pattern/ is a pattern match operator. Perl is very easy to learn. Enter 'H' or 'h' for help.
In reply to Re^3: Help with split() function
by halfcountplus
in thread Help with split() function
by negzero7
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |