i want to create an excel file ...
This tells us your ultimate goal, but does not describe what you expect the code of the OP to do and just what is going wrong. dreadpiratepeter was trying to get details of this kind.
It seems that the OP code is a first attempt at reading the contents of a file and processing and printing the contents. This is a good first step to your final goal. As it stands, I can make a guess at what is happening.
The regex /("/w+/")/ has extraneous / (forward slash) characters in it that are interpreted as premature terminations of the regex (see muba's analysis below). Try something like this (untested):
use warnings;
use strict;
my $filename = 'myfile';
open my $fh, '<', $filename or die "opening '$filename': $!";
while (<$fh>) {
if (m{ ("\w+") }xms) {
print "$1 \n";
}
}
close $fh;
|