M
Marek Stepanek
Hello happy Perlers,
it is very strange: I capture a string as I used it many times, and a
Boolean value is given back. All the day I meditated over this script, but
something very obvious I am missing.
Have a nice evening and sorry for this question
marek
############
#!/usr/bin/perl
use warnings;
use strict;
my (@lines);
while (<DATA>)
{
chomp;
push @lines, $_;
}
foreach my $line (@lines)
{
my $date = $line =~ /^([\d.]+)/;
# why is this regex wrong?
# I want to capture the dates: 17.07.2006 ...
print "\n$date";
}
__DATA__
17.07.2006 CC mU 58.00
17.07.2006 Fr. Knorr CC mU 60.00
18.07.2006 Unterföhring MUC Link CC mU 45.00
19.07.2006 CC mU 58.00
20.07.2006 MUC Hanauer Hermann/Wacki CC mU 55.00
21.07.2006 Claudio/Rock CC oU 55.00
24.07.2006 CC mU 54.00
24.07.2006 CC mU 50.00
24.07.2006 CC mU 55.00
25.07.2006 CC mU 82.00
26.07.2006 -3.7 Uhr! Königin MUC Wacki Bar oU 55.00
27.07.2006 hin rück Link CC mU 122.00
it is very strange: I capture a string as I used it many times, and a
Boolean value is given back. All the day I meditated over this script, but
something very obvious I am missing.
Have a nice evening and sorry for this question
marek
############
#!/usr/bin/perl
use warnings;
use strict;
my (@lines);
while (<DATA>)
{
chomp;
push @lines, $_;
}
foreach my $line (@lines)
{
my $date = $line =~ /^([\d.]+)/;
# why is this regex wrong?
# I want to capture the dates: 17.07.2006 ...
print "\n$date";
}
__DATA__
17.07.2006 CC mU 58.00
17.07.2006 Fr. Knorr CC mU 60.00
18.07.2006 Unterföhring MUC Link CC mU 45.00
19.07.2006 CC mU 58.00
20.07.2006 MUC Hanauer Hermann/Wacki CC mU 55.00
21.07.2006 Claudio/Rock CC oU 55.00
24.07.2006 CC mU 54.00
24.07.2006 CC mU 50.00
24.07.2006 CC mU 55.00
25.07.2006 CC mU 82.00
26.07.2006 -3.7 Uhr! Königin MUC Wacki Bar oU 55.00
27.07.2006 hin rück Link CC mU 122.00