some help again with if statement

S

starfrit

I need some help again converting an old script with a new structure

Before, I had this line with this IF
1. WASHINGTON, SVATOS 3 (EXELBY, JOHNSON), 03:52<BR>
if (m/^\d+.\s*(\w*.*)\,.\s*(\w*.*)\s+(\d+).\(.*\)\,.*/)


Now, the same line is written like this
1. Washington Capitals , Marek Svatos 3 (Garnet Exelby, Mike Johnson)
at 3:52<br />


I need Washington Capitals to be $1, Svatos to be $2 and 3 to be $3 and
the space after Capitals must not be in $1


Thanks
 
P

Paul Lalli

starfrit said:
I need some help again converting an old script with a new structure

Before, I had this line with this IF
1. WASHINGTON, SVATOS 3 (EXELBY, JOHNSON), 03:52<BR>
if (m/^\d+.\s*(\w*.*)\,.\s*(\w*.*)\s+(\d+).\(.*\)\,.*/)


Now, the same line is written like this
1. Washington Capitals , Marek Svatos 3 (Garnet Exelby, Mike Johnson)
at 3:52<br />


I need Washington Capitals to be $1, Svatos to be $2 and 3 to be $3 and
the space after Capitals must not be in $1

You seem to have forgotten half of your post. You only posted the bit
about your requirement, but failed to include what you have tried so
far in an attempt to solve your own problem.

Surely, you're not simply asking people to do this for you, are you?

Paul Lalli
 
S

starfrit

No, that's not my intention, but i'm not by far an expert in Perl, I
can safely browse the code and now where I'm at though. Like I said,
I'm trying to adapt a script made for the community. I tried many
variations and I did not kept copy of my attemps. Other that that, I'm
not sure what you're asking for.

But juste to make sure, if i'm right
\d+. is for the 1.
\s* is for the first space
(\w*.*) is a Wildcard for WASHINGTON
\,. is the ,
\s* is another space
(\w*.*) is a wildcard for SVATOS
\s+ another space
(\d+).\(.*\)\,.* is for the rest of the line, which is irrelevant for
the output I want to make
 
T

Tad McClellan

starfrit said:
No, that's not my intention,


What is not your intention?

Please quote some context in followups like everybody else does.

I tried many
variations and I did not kept copy of my attemps. Other that that, I'm
not sure what you're asking for.


He was asking to see some of your attempts!

If you don't have them anymore, then make one more attempt and post that.
 
S

starfrit

First, you don't have to be so rude, your little points are very
agressive, and second, I'm a professional IT, not a newb. I just
didn't do much programming for the last years, and my Perl is very
rusty because I learned that in school a few years ago.

As for my problem, here's the code of the ciomplete function. What it
does is browse through an html file which id a boxscore. What I need
to do with this code is find the line in the html which are goals
scored, and output them in another html file like this : SVATOS 3,
JOHNSON 15, LILES 1

# Team section
# <H1>Rangers at Vancouver</H1>
if (m/<h1>\s*(\w*.*) vs \s*(\w*.*)/)
{
$AWAY = uc($1);
$AW_ABREV = uc($abrev{$AWAY});
$HOME = uc($2);
$HM_ABREV = uc($abrev{$HOME});
#print "-=> $AWAY,";
#print "-=> $HOME,";
}

# Goal section
#old 1. WASHINGTON, SVATOS 3 (EXELBY, JOHNSON), 03:52<BR>
#new 1. Washington Capitals , Marek Svatos 3 (Garnet Exelby, Mike
Johnson) at 3:52<br />
if (m/^\d+.\s*(\w*.*)\,.\s*(\w*.*)\s+(\d+).\(.*\)\,.*/){
print "-=> $1,";
if ($1 eq $AWAY) {
if (defined($sc_away{$2}))
{
$sc_away{$2} .= ",$3";
}
else
{$sc_away{$2} .= "$3";}
$goal_a++;
}
else
{
if (defined($sc_home{$2})){ $sc_home{$2} .= ",$3";}
else {$sc_home{$2} .= "$3";}
$goal_h++;
}
}
 
J

Jürgen Exner

starfrit said:
First, you don't have to be so rude, your little points are very
agressive,

Who is "you"? What are you referring to?
Please quote appropriate context -as has been customary for 2 decades- such
that people have a chance to know what you are talking about.
and second, I'm a professional IT, not a newb.


Oh, really? And you can't distinguish between a problem with an if statement
and a regular expression match?
Interesting.

So long

jue
 
P

Paul Lalli

starfrit said:
First, you don't have to be so rude,

No one was being rude to you. You, on the other hand, have been
extraordinarily rude throughout this thread.
your little points are very
agressive, and second, I'm a professional IT, not a newb.

And you think that somehow exempts you from following the requests of
the people you would like to help you? How many times in this thread
were you asked to properly quote in your responses? How many times
were you asked to read the Posting Guidelines? Clearly, you felt those
two tasks were beneath you. And yet you continue to ask for our help.
I just
didn't do much programming for the last years, and my Perl is very
rusty because I learned that in school a few years ago.

I have no idea what you think the relevance of any of this is.
As for my problem, here's the code of the ciomplete function.

Why are you posting that? Did you not read *any* of the posts that
asked you to post a SHORT but COMPLETE script that demonstrates your
error? Is this beneath you do, because you're a "professional IT"?
What it
does is browse through an html file which id a boxscore. What I need
to do with this code is find the line in the html which are goals
scored, and output them in another html file like this : SVATOS 3,
JOHNSON 15, LILES 1

Once again, you post a *requirement*, but no *attempt*. We're back
where we started!

You have thoroughly demonstrated your rudeness in every post you've
made. Good luck to you in your "professional IT" future.

Paul Lalli
 
B

Ben Bullock

J$B!&(Bgen Exner said:
Who is "you"? What are you referring to?
Please quote appropriate context -as has been customary for 2 decades-
such that people have a chance to know what you are talking about.



Oh, really? And you can't distinguish between a problem with an if
statement and a regular expression match?
Interesting.

That's a nice example of "extreme rudeness".
 
R

robic0

That's a nice example of "extreme rudeness".

Oh yea, lets pick on the IT professionals. IT pro's have job security,
consultants (an wannbe ones) have short and poor lives.

Expect it here. Welcome to the ng partner
robic0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top