Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: simple regex (again)

by davorg (Chancellor)
on Oct 23, 2001 at 15:05 UTC ( #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 :(


"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...



    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 :)


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

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

        I'll keep trying..



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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://120746]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2017-05-29 07:09 GMT
Find Nodes?
    Voting Booth?