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;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|