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;
Back to
Seekers of Perl Wisdom