in reply to Advance Regular expression questions

Not with a regular expression, but easier to understand, maintain and debug:
use Modern::Perl; while (<DATA>) { my (undef, $first, $second, $third, $fourth, $balance) = split /[( +,]/, $_, 6; $first++; $second += 3 unless $second == 0; $third += 3; $fourth += 10 if $fourth == 55 or $fourth = 56; say '(', join ', ', $first, $second, $third, $fourth, $balance; } __DATA__ (7, 0, 7, 55, NULL, 0, '', 'Wise Package Studio Overview and its advan +tage', 1260350867, '203.145.176.177', 0, 0, 0, 0, 197, 0, 0, 0, ''), (8, 0, 8, 55, NULL, 0, '', 'what is Tarma QuickInstall 2 and its usage +', 1260351089, '203.145.176.177', 0, 0, 0, 0, 61, 0, 0, 0, ''), (9, 0, 9, 55, NULL, 0, '', 'what is Tarma Installer 5 and its usage?' +, 1260351321, '203.145.176.177', 0, 0, 0, 0, 253, 0, 0, 0, ''), (10, 0, 10, 56, NULL, 0, '', 'what is Tarma ExpertInstall 3 and its us +age?', 1260351466, '203.145.176.177', 0, 0, 0, 0, 69, 0, 0, 0, ''), (11, 0, 11, 55, NULL, 0, '', 'What is Smart Install Maker and its usag +e?', 1260351588, '203.145.176.177', 0, 0, 0, 0, 241, 0, 0, 0, ''), (14, 0, 14, 55, NULL, 0, '', 'what is MSI Studio and its use?', 126035 +2667, '203.145.176.177', 0, 0, 0, 0, 174, 0, 0, 0, ''),

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: Advance Regular expression questions
by tobyink (Canon) on Jan 05, 2012 at 10:46 UTC

    /[(,]/ is a regular expression.

      You are right, of course!

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James