Sample line from a file:
one two three uname whirlcano four five
I want to extract the user names from multiple files
foreach $file (@file_names)
{
open(my $fh, '<:encoding(UTF-8)', $file)
or die "Could not open file '$file' $!";
while (my $row = <$fh>)
{
if($row =~ "uname")
{
#here I want to extract only the immediate word after "uname", which is "whirlcano" in the above example.
}
}
}
Thanks in advance.