Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

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

OK, but you are still not trying to do what I suggested.

Minimize your code and create much smaller pieces of test code so you will be able to learn how to debug your own code.

I'll give you another example what I am talking about. In the next piece of text code I have found multiple problems, so play around with it a little bit and try to fix it yourself:

use strict; use warnings; use Data::Dumper; my ($file_1, $file_2) = ('output1.csv', 'output2.csv'); open my $fh, '<', $file_1 or die "Can't open $file_1: $!"; my %first = map { chomp; split /\s*,\s*/ } <$fh>; print Dumper( \%first ) ; open $fh, '<', $file_2 or die "Can't open $file_2: $!"; my %second = map { chomp; (split /\s*,\s*/)[1,2] } <$fh>; print Dumper( \%second ) ; foreach my $name (sort keys %first) { if (not exists $second{$name}) { print "Devices should be added: $name\n"; next; } if ($first{$name} eq $second{$name}) { print "Match found $name, $first{$name}\n"; } else { print "UPDATE need be done for $second{$name}\n"; open ( my $input_1, '<', 'output1.csv' ) or die $!; while ( <$input_1> ) { chomp; print " input_1 = $_\n" ; my ($name_1, $ip_1) = split /,/; print " (1) $name, $ip_1\n" ; (my $id, $first{$name}, $second{$name}) = split /,/; print " (2) $id, $first{$name}, $second{$name}\n" ; } } }

In reply to Re^3: HTTP PUT Request with separate values in csv by Veltro
in thread HTTP PUT Request with separate values in csv by StayCalm

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 exploiting the Monastery: (2)
As of 2024-04-19 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found