steph_bow has asked for the wisdom of the Perl Monks concerning the following question:
Hello, Dear Monks
My script detects a line in "EXEMPLE.txt" that contains the element "coucou".
I would like to get the rest ot the text from this line. Could you help me ? Thanks
#!/usr/bin/perl use strict; use warnings; use diagnostics; use Cwd; use File::Copy; my $element = "coucou"; open (INFILE, "<EXEMPLE.txt"); while (my $line = <INFILE>){ if ($line =~ /$element/){ my $outfile = "RESEARCHED_text_"."$element".".txt"; open (OUTFILE, ">$outfile"); print OUTFILE "$line"; close OUTFILE; } } close INFILE;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: get the rest of the text
by johngg (Canon) on Feb 27, 2008 at 12:18 UTC | |
Re: get the rest of the text
by moritz (Cardinal) on Feb 27, 2008 at 09:58 UTC | |
Re: get the rest of the text
by Punitha (Priest) on Feb 27, 2008 at 09:59 UTC | |
Re: get the rest of the text
by McDarren (Abbot) on Feb 27, 2008 at 12:30 UTC |
Back to
Seekers of Perl Wisdom