in reply to Getting data from Cisco Call Manager with Perl
Hi! There are a great many things you can improve in the Perl code here.
Since I don't have your module SNMP_util and I can't really test things, I won't try to rewrite your entire script, but here's a good starting point:
#!/usr/bin/env perl use strict; use warnings; use NetAddr::IP; use SNMP_util; use Text::CSV (); my $csv = Text::CSV->new({binary => 1}) or die "Can't use Text::CSV: ".Text::CSV->error_diag(); open my $fh, "<:encoding(utf8)", "formerlyBridges2Input.csv" or die "Can't open CSV: $!"; while (my $row = $csv->getline($fh)) { # $row is now an array reference containing the # CSV's fields. # If the line is "a,b,c" then we will have: # $row->[0] "a" # $row->[1] "b" # $row->[2] "c" }
Please take a look at that and try to work in your code using the CSV parser and show us what you get. If you have a specific problem, we'll be more than happy to help a bit more.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Getting data from Cisco Call Manager with Perl
by adamZ88 (Beadle) on Mar 02, 2017 at 22:00 UTC |