Nope... the . loses its metaness when inside the character class...
where the regexp *does* stuff up is that it allows more than one decimal
point in the string...
deen "yayy I know something!" hameed
On Fri, 25 Jan 2002, John Edwards wrote:
> Oh. One more thing.
>
> Your regex should have t
On Jan 25, John Edwards said:
>Your regex should have the . escaped. Currently it is matching on either a
>number or *any character* between the a and z. Although this works, it may
>bite you if you have a line like this...
Regex metacharacters all lose their meaning inside a character class.
[
On Fri, Jan 25, 2002 at 01:58:00PM +1100, Stuart wrote:
> Hi
> Please help if you can.
> Thanks again
> Stuart Clark
>
>
> How do I add all the number between the "a" and the "z"
> My output file only gives me the instances of the matching pattern and
> not the total
>
> # start of file test
n the results.
Here is how it should look
/a([\d\.]+)z/
John
-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: 25 January 2002 09:16
To: 'Stuart Clark'; Perl List
Subject: RE: simple perl question
This line
$total += /a([\d.]+)z/;
is adding the numbe
This line
$total += /a([\d.]+)z/;
is adding the number of successful matches (1 for each iteration in this
case) of the regex to $total. There are three lines, three matches.
You need to store the result of the regex as a list value, not scalar.
while () {
($match) = /a([\d.]+)z/;
On Jan 25, Stuart Clark said:
>How do I add all the number between the "a" and the "z"
>My output file only gives me the instances of the matching pattern and
>not the total
>
>$total += /a([\d.]+)z/;
A regex in scalar context returns whether or not it matched. If you want
to get th
Unsure exactly what you are really after, but you would code your program
into subs with one while loop or some controlling mechanism which would
allow you to go where you wanted within your program.
sub suba {
}
sub subb {
}
sub subcc {
}
while ( 1 ) {
print "Please enter value:"
--- [EMAIL PROTECTED] wrote:
> I have a very simple question.. i want to know how can I tell my
> program to go back to the beginning of the program depending on the
> user input?
>
> Candice
Not homework, is it?
If so, you should really say that before posting the question.
Even so, here's a h