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 the value of $1, you'll have to do something like: $total += $1 if /a([\d.]+)z/; or $total += (/a([\d.]+)z/)[0]; I'd choose the first over the second, because it is less obfuscated. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]