Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Greetings...

I have a script that parses a csv file, looks up some data in another file, and generates a report. Pertinent code is here:

my $report_files_dir = "../Working/New_data"; my $filename_pattern = "Remedy.csv"; $interface_file = "nodes.csv"; open ( my $interface_data, "<", "$report_files_dir/$interface_file" ) +or die $!; opendir ( my $report_files, $report_files_dir) || die "can't opendir $ +report_files_dir: $!"; for ( sort readdir $report_files ) { next unless $_ =~ /$filename_pattern/; open ( my $remedy_file, "<", "$report_files_dir/$_" ) or die $!; while (<$remedy_file>) { chomp; next if ($. == 1); # Parse info from the current line # Use a returned value ($first_node) to look up data in anothe +r file: LOOKUP: while (<$interface_data>) { chomp; my @list = split/\|/; my $ref_id = &clean( $list[2] ); if ( $ref_id =~ /$first_node/ ) { # The CMTS name is in Column 0 $cmts_name = $list[0]; # The CMTS Interface is in Column 1 $cmts_interface = $list[1]; last LOOKUP; } } seek ( $interface_data, 0, 0 ); # Finish doing the report generation... } close ( $remedy_file ); } closedir ( $report_files ); close ( $benchmark_data ); close ( $interface_data ); close ( $progress_file );

But I get the following warnings:

Use of uninitialized value in subtraction (-) at ./load_Remedy.pl line + 503, <$interface_data> line 1894801. Use of uninitialized value in subtraction (-) at ./load_Remedy.pl line + 503, <$interface_data> line 5825736. Use of uninitialized value in subtraction (-) at ./load_Remedy.pl line + 503, <$interface_data> line 6546698.

The issue is not the uninitialized value ( I'm comparing two dates in line 503, and I may indeed be missing a date value in the original data, but the fact the the data file is $remedy_file, not $interface_data, and the line values are nonsensical, none of the files has more that 100K lines. Am I not using seek properly?


In reply to filehandle in warning not what I expected... by spstansbury

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 22:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found