REGEXP:Promenna v nahrazovacim retezci

Jaroslav Knespl j.knespl na seznam.cz
Středa Leden 10 17:33:10 MET 2001


Nevi nekdo, proc vystup z nasledujiciho programu je

1 Hugo 1 comming home
2 Hugo 1 comming home
3 Hugo 1 comming home
4 Hugo 1 comming home
5 Hugo 1 comming home
6 Hugo 1 comming home
7 Hugo 1 comming home
8 Hugo 1 comming home
9 Hugo 1 comming home

a ne

1 Hugo 1 comming home
2 Hugo 2 comming home
3 Hugo 3 comming home
4 Hugo 4 comming home
5 Hugo 5 comming home
6 Hugo 6 comming home
7 Hugo 7 comming home
8 Hugo 8 comming home
9 Hugo 9 comming home


Onen program:

$string = "Hugo is comming home";

for ($i=1;$i<10;$i++) {
    $string =~ s/is/$i/;
    print "$i $string\n";
}

Jarda



Další informace o konferenci Perl