in reply to Re^2: WHY DOESN'T THIS WORK
in thread WHY DOESN'T THIS WORK

length[$QMName] should be length($QMName)
same for
length[$Depth] length[$Persistence] length[$Description]
poj

Replies are listed 'Best First'.
Re^4: WHY DOESN'T THIS WORK
by Anonymous Monk on Mar 07, 2016 at 12:42 UTC

    Thanks but that doesn't help with my issue.

      You try to initialize (for example) $listenerName in the following lines:

      &QueueManager::AddListenerName($SplitLine[7]); &QueueManager::AddPort($SplitLine[8]); &QueueManager::AddChannel($SplitLine[9]); &QueueManager::AddQueue($SplitLine[10], $SplitLine[11], $S +plitLine[12], $SplitLine[22]);

      So, most likely, @SplitLine does not contain what you think it does. Use Data::Dumper to see what is in @SplitLine and then change your code. Also, maybe just use Text::CSV_XS for parsing the CSV.

      length[$QMName]

      When I first saw this expression and the others like it, I thought "No way that compiles! This guy's not even showing us the code he's using!" Lo and behold:

      c:\@Work\Perl\monks>perl -wMstrict -le "our $Depth; $Depth = 'foo'; ;; if (length[$Depth] != 0) { print 'THIS WORKS?!?'; } ;; if (length[] != 0) { print 'THIS WORKS TOO?!?!?'; } " THIS WORKS?!? THIS WORKS TOO?!?!?
      The trick, I now realize, is that  [ ... ] is the anonymous array constructor. The  [$Depth] and  [] expressions build anonymous arrays of one and zero elements, respectively, and return references to the arrays. The reference is then stringized and its length (always non-zero) taken and compared to zero. If having meaningful code doesn't help you with your issue, you have a very, very serious problem indeed.


      Give a man a fish:  <%-{-{-{-<

      Test your csv files with this basic program

      #!perl use strict; use warnings; use Text::CSV_XS; my $dir = 'C:/Strawberry/perl_tests/'; my @AllFiles = ('SKYCHAINALL.csv','CRISALL.csv'); for my $file (@AllFiles) { print "\nFilename = '$file'\n"; my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1 }); open my $fh, '<', $dir.$file or die "Could not open $dir$file: $!"; while (my $row = $csv->getline($fh)) { print join "|",@$row[5,7..12,22],"\n"; } close $fh; }
      poj