i can't get the script to work when using csv files' i get error message as show, i have tested that the files exist and can be open in a test.pl
Use of uninitialized value in open at C:\scripts\newnew.pl line 72. Use of uninitialized value in concatenation (.) or string at C:\script +s\newn l line 72. cannot open '': No such file or directory at C:\scripts\newnew.pl lin +e 72.
use strict; use warnings; my $masterStr = <<EOF; john.co.uk,Acton,Backup,Team,backup,bkup-01,External, gim.com,Acton,Backup Team,backup,bumas1,internal, jeff.be.com,Acton,Backup Team,backup,bumas1,internal, scream,Acton,Backup Team,backup,bumas1,internal, ACTDFVUA.co.uk,Acton,Backup Team,backup,imrn,internal, EOF my $dailyStr = <<EOF; Server,Type,Reason,Data at Risk,Ticket,Resolution john.com,F,No email received,YES, gim,S,Failures,Some,8790' elephant.com,F, No email received,YES' jeff.co.com,F, No email received,YES, scream,S,1 email received,Some, banana,F,No email received,YES, EOF my %masters = loadMasters(); my @dateParts = localtime (); my ($day, $month, $year) = @dateParts[3 .. 5]; my $OUTFILE = ("C:\\temp\\testtest.txt"); open OUTPUT,">$OUTFILE" or die " cannot cannot open '$OUTFILE': $!"; my $INFILE = ("c:\\Temp\\server.csv"); my $INFILE1 = ("C:\\temp\\failures.csv"); $year += 1900; $month += 1; open my $dailyIn, '<', $INFILE1 or die " cannot open '$INFILE1': $!"; #open my $dailyIn, '<', \$dailyStr; <$dailyIn>; # Skip header line while (defined (my $line = <$dailyIn>)) { chomp $line; my ($server, $type, $reason, $status, $ticket, $resolution) = split ',', $line; $_ = uc $_ for $server, $type; $_ ||= '-- missing --' for $status, $ticket, $resolution; if ($type eq "F") { $type = "BACKUP FAILED"; } elsif ($type eq "S") { $type = "SKIPPED FILES"; $ticket = "DO NOT RAISE TICKET"; } (my $serverKey = $server) =~ s/\..*//; if (!exists $masters{$serverKey}) { print "$server not known please update\n"; next; } printf OUTPUT "%s %s %s,%s,%s,%s,%s,%s,%s,%s,%s,%s, \n", $day, $month, $year, $masters{$serverKey}{loc}, $masters{$serverKey}{team}, $masters{$serverKey}{owner}, $server, $type, $reason, $status, $ticket, $resolution; } sub loadMasters { my %masters; open my $masterIn, '<', $INFILE or die " cannot open '$INFILE': $!"; #open my $masterIn, '<', \$masterStr; while (defined (my $line = <$masterIn>)) { chomp $line; my ($machine, $loc, $team, $software, $backup, $owner) = split + ',', $line; (my $machineKey = uc $machine) =~ s/\..*//; warn "Multiple servers match '$machineKey'!\n" if exists $masters{$machineKey}; $masters{$machineKey} = { server => $machine, loc => $loc, team => $team, software => $software, backup => $backup, owner => $owner }; } return %masters; }

In reply to Re^2: compare csv files only to first fullstop character by john.tm
in thread compare csv files only to first fullstop character by john.tm

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.