#!/usr/bin/perl -w
use strict;
$_ = "Hello there, neightbor";
if (/(\w+) (\w+), (\w+)/) {
print "The first words was \"$1\" \"$2\" \"$3\".\n";
}
my $first_word = $1;
#don't forget to save $1 if you nedd it
$_ = "Go here dody";
if (/(\w+) (\w+) (\w+)/) {
print "The second words was \"$1\" \"$2\" \"$3\".\n";
}
print "The last word of last words was \"$3\".\n";
print "The first word of first words was \"$first_word\".\n";
Подписаться на:
Комментарии к сообщению (Atom)
Комментариев нет:
Отправить комментарий