Dear Wise and Serene Monks,

I have made a code that gives the expected result but gives a lot of warnings, so it means my code shoud be cleaner
Could you tell me how ?

Here is the start file :
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;"ACA879";"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;"DLH9FM";"08:53";533;"08:57";537

Here is my code :
#!/usr/bin/perl use strict; use warnings; use diagnostics; ################# IN WHICH DIRECTORY WE ARE ######################## my $Current_Dir = `pwd`; print STDOUT "the current directory is $Current_Dir"; ##################################################################### ################### OPEN THE FIRST INFILE ############################ # open the first file # do not forget the "" to declare my ${first_file} = my ${first_file} = "$ARGV[0]"; open(INFILE,"<${first_file}") or die "Can't open ${first_file} : $!"; ################################################################# ################### OPEN THE OUTFILE ############################ # name of the OUTFILE # never put a \n at the end of the OUTFILE name otherwise it does not +create the output my ${outfile_name} = "Analysis_${first_file}"; # to open the file # OUTFILE is the name of the HANDLE in this case open (OUTFILE, ">${outfile_name}") or die "Can't open ${outfile_name +}: $!"; ################################################################## while (<INFILE>){ chomp($_); my @Parts = split(";"); my $aircraft_id = $Parts[1]; my $ATO_min = $Parts[3]; my $CTO_min = $Parts[5]; my $ATO = $Parts[2]; my $CTO = $Parts[4]; my $delay_ATO_CTO_min; if (($CTO =~ /(\d\d):(\d\d)/) & ($ATO =~ /(\d\d):(\d\d)/)){ $delay_ATO_CTO_min = $CTO_min-$ATO_min; } else{ $delay_ATO_CTO_min = ""; } my $flight_big_delay; # condition on the delay if ($delay_ATO_CTO_min > 10){ $flight_big_delay = $aircraft_id; print OUTFILE "$aircraft_id;$ATO_min;$CTO_min;$delay_ATO_CTO_m +in;$flight_big_delay\n"; } else{ print OUTFILE "$aircraft_id;$ATO_min;$CTO_min;$delay_ATO_CTO_m +in\n"; } } close INFILE; close OUTFILE;

Here is my output file
"";;; "DAL11";527;530;3 "";;; "";;; "";;; "ACA879";531;533;2 "";;; "SHT8K";528;535;7 "";;; "DLH9FM";533;537;4

And here are the warnings:
Argument "" isn't numeric in numeric gt(>) at Monks_Treatment.pl (that +'s the name of the program) line 60, <INFILE>
update : the update concerns both the input and output since the original post data copied from wordpad, not from excel, for the input data as well as the output data

In reply to warnings unexpecetd by steph_bow

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.