I have lines as follows in a file
Today is amazing.nice day
Today is amazing.nice but still I haven't done anything
Yesterday was just a normal day
Tomorrow probably will be amazing.new day
What i want to accomplish :
I want to be able to go through lines and match "(amazing.*)". If (amazing.*) is unique then put it in an array and also print that line if not ignore it.
Basically, this is the result I am looking for.
Today is amazing.nice day
Tomorrow probably will be amazing.new day
and so forth....
So far I have only written this much code. I just don't know where to go from here. Any direction on how to approach this would be very much appreciated.
#!/usr/bin/perl -w
use strict;
while ( my $line = <> )
{
if ( $line =~ m/(\(amazing.+?\))/)
{
my $string="$1";
@allstrings = ($string);
}
}