Perlについての質問箱 32箱目
■ このスレッドは過去ログ倉庫に格納されています
0273デフォルトの名無しさん
2007/08/28(火) 06:51:38おまえのできてないだろwww
#!/usr/bin/perl
use strict;
my $pattern=<STDIN>; chomp $pattern;
my $replace=<STDIN>; chomp $replace;
while (! eof STDIN) {
my $string =<STDIN>; chomp $string;
if (my (@matches) = ($string =~ /$pattern/)) {
my $rep = $replace;
$rep =~ s/\$(\d+)/$matches[($1 -1)];/eg;
$string =~ s/$pattern/$rep/eg;
}
print $string,"\n";
}
■ このスレッドは過去ログ倉庫に格納されています