in reply to warnings unexpecetd
The warning that you comment is due to:
$delay_ATO_CTO_min = "";
After that assignment you try to use $delay_ATO_CTO_min as a number:
if ($delay_ATO_CTO_min > 10){
Nevertheless, the script you posted doesn't seem to parse the input file you provided (the fields in the input file are not separated by ";", you don't check for "empty" lines (e.g. lines with only the time), etc...). Here is a version of your script with some of these problems corrected:
use strict; use warnings; while (<DATA>){ chomp($_); my ($aircraft_id,$ATO,$ATO_min,$CTO,$CTO_min) = (split /\s+/)[1,2,3, +4,5]; next if (!defined $ATO); my $delay_ATO_CTO_min = 0; if ((defined $CTO && $CTO =~ /\d\d:\d\d/) && (defined $ATO && $ATO +=~/\d\d:\d\d/)){ $delay_ATO_CTO_min = $CTO_min-$ATO_min; } my $flight_big_delay; # condition on the delay if ($delay_ATO_CTO_min > 10){ $flight_big_delay = $aircraft_id; print "$aircraft_id;$ATO_min;$CTO_min;$delay_ATO_CTO_min;$flight_b +ig_delay\n"; } else{ print "$aircraft_id;$ATO_min;$CTO_min;$delay_ATO_CTO_min\n"; } } __DATA__ 08:48:45 08:49:43 DAL11 08:47 527 08:50 530 08:50:41 08:51:40 08:52:38 08:53:36 ACA87 08:51 531 08:53 533 08:54:35 08:55:33 SHT8K 08:48 528 08:55 535 08:56:31 08:57:30 DLH9F 08:53 533 08:57 537
Outputs:
DAL11;527;530;3 ACA87;531;533;2 SHT8K;528;535;7 DLH9F;533;537;4
citromatik
|
|---|