Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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;

In reply to Re^3: separating two sententences by AnomalousMonk
in thread separating two sententences by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found