> -----Original Message-----
> From: COLLINEAU Franck FTRD/DMI/TAM
> [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 26, 2001 11:12 AM
> To: Perl (E-mail)
> Subject: code doesn't work
>
>
> Hi,
>
> Can anybody tell me why this code doesn't work ?
Define "doesn't work"
>
> #!/usr/bin/perl -w
>
> open(FICHIER,"rdn1.html");
> open (TEMP,">>temp.html");
> while(<FICHIER>)
> {
> print TEMP $_ until ($_ =~m/ancre/);
This doesn't look good. The loop condition is not modified in the loop body.
So the print will either happen once (if $_ contains "ancre") or an infinite
number of times (if $_ does not contain "ancre").
If you want the outer loop to stop after printing the line containing
"ancre", you need:
print TEMP $_;
last if /ancre/;
Or maybe it's something else entirely.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]