Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: simple regex (again)

by davorg (Chancellor)
on Oct 23, 2001 at 15:05 UTC ( [id://120746]=note: print w/replies, xml ) Need Help??


in reply to simple regex (again)

When you posted that node, did you see some text that said:

If something looked unlike you expected it to you might need to check out Writeup Formatting Tips

Which bit of that didn't you understand? Or do you always write your code like that?

It's much easier to help you if you surround your code in <code> ... </code> tags.

Update: Yeah, OK. I mistyped "bit" as "did". Corrected :(

--
<http://www.dave.org.uk>

"The first rule of Perl club is you don't talk about Perl club."

Replies are listed 'Best First'.
Re(2): simple regex (again)
by graq (Curate) on Oct 23, 2001 at 15:18 UTC
    That's not the all of it, I have reformatted the original question (see below) - and I still am feeling unsure what it is the original post actually wants...
    And there appears to be numerous other helpful suggestions to improve the code.

    I would suggest that the original poster tried SEARCHING the site to look for some relevant answers, and avoid a lot more RTFM answers...

     

    __REFORMATTED MESSAGE__

    This works fine for outputing to file, however, still unable to assign to array without opening the output afterwards.
    Would be good if I could set overall match to array at the same time as sending to output.

    #!perl.exe my $filename="e:\test.out.txt"; my $output="e:\out.txt"; sub body { if (-r $filename) { open(FILE,"<$filename"); open(OUTPUT, "> $output"); while() { chomp; if (/Datasource:/) { print OUTPUT "\n", $_; } if (/Passed:/) { $section="passed"; next; } elsif (/Failed:/) { $section="failed"; print OUTPUT "\n",$_; next; } elsif (/Exception:/) { $section="except"; print OUTPUT "\n",$_; next; } if ($section ne "passed") { if (/(test\.)|(Summary:)/) { print OUTPUT "\n",$_; } } } close(FILE); close(OUTPUT); } else { print("cant read file ",$filename,"\n"); } }

    -- Graq's Home Page

      Your reformatting has missed the fact that the AM actually had while (<FILE>). I've now added <code> tags to the original post which makes it clearer.

      But not necessarily very clear :)

      --
      <http://www.dave.org.uk>

      "The first rule of Perl club is you don't talk about Perl club."

        Argh..yes.
        Not only was I that slow about it that someone else had added the code before me, but I went and got it wrong.
        DOH!

        I'll keep trying..

        Graq

        "Shhhhhhhhhhhhh!"

Re: Re: simple regex (again)
by Anonymous Monk on Oct 23, 2001 at 16:52 UTC
    "Which did of that" - sorry don't understand your question.
Re: Re: simple regex (again)
by Anonymous Monk on Oct 23, 2001 at 17:10 UTC
    Ok Ok. Apologies for not tagging and for not checking the paste (blank while).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://120746]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found