Your code is very broken. It includes lots of syntax errors, and you should include use strict;
and use warnings;
in EVERY script.
That said, I can help you a little bit by demonstrating how one would parse a file and pull out various regexes at the same time:
use strict;
use warnings;
while (<DATA>) {
print "Processing: $_";
while (m{(d{2}/d{2}/d{4})|(-d+)|(d+.?d*)}g) {
my ($date, $neg, $pos) = ($1, $2, $3);
if (defined $date) {
print " Found Date: $date
";
} elsif (defined $neg) {
print " Found Neg: $neg
";
} elsif (defined $pos) {
print " Found Pos: $pos
";
}
}
}
__DATA__
Hello -12, 3.4 and 32. Where did you
go on 01/01/2013 ? On 01/01/2013, we
went home. -4 plus 5 makes 1.
03/02/2013
Outputs:
Processing: Hello -12, 3.4 and 32. Where did you
Found Neg: -12
Found Pos: 3.4
Found Pos: 32.
Processing: go on 01/01/2013 ? On 01/01/2013, we
Found Date: 01/01/2013
Found Date: 01/01/2013
Processing: went home. -4 plus 5 makes 1.
Found Neg: -4
Found Pos: 5
Found Pos: 1.
Processing: 03/02/2013
Found Date: 03/02/2013
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…