Tanktalus: I really don’t mind you calling what I wrote a glorified Batch file script. That’s what it ends up being.

I understand how your line is more efficient, but it’s my intent to use the dir_list.lst else where. As for the glob function I tried to use it in a copy, but I think I really mucked that up.

copy (glob$source\\*.txt $dest\\*.txt)

as a noub to perl, I’m just not getting some stuff.

AnomalousMonk I understand what you’re implying, so I took a look at the files. But I don’t see anything like a newline terminated, so are you saying that as the file info fills the array, the function puts the /n in the array. In any case as I have  “copy $source\\$temp $dest\\$temp” in the script so that it outputs on the screen what the next line is meant to do. What is outputted is the correct syntax for cmd.

Scorpio17 I tried to use the chomp but is didn’t make and difference.

Oh grate Priest TGI, I thank you so much for all you effort. But alas not only did your script not work for me, it caused the script to crash. No errors from the script, Just perl crashes. BTW I forgot to note that I’m using perl 5.8.1.

I fully expect to be working on more Perl scripts in the Future, so I will take your advice and read threw those tutorials to avoid more mud balls. But my issue is getting weirder. I added another function to the script. I actually copied one working function and edited the name of the file and source. But once again, the script is putting the file in the wrong location. To that end I’m going to attach the whole script. For some reason option 4. instead of putting the files in $dest which would be \\xxxx\\xxxxx\\suntrust\oneworld, it’s putting the file in \\xxx\xxxxx which on my machine is represented as the y: drive. But if you note the syntax of 4 is the same as options 6 and 1 and those work correctly.

@imonth = ("01","02","03","04","05","06","07","08","09","10","11","12" +); @iday = ("00","01","02","03","04","05","06","07","08","09"); @timedata = localtime(time); $mon = @timedata[4]; $month = @imonth[$mon]; $tmpday = @timedata[3]; $hour = @timedata[2]; $min = @timedata[1]; $sec = @timedata[0]; if ($tmpday < 10) { $day = @iday[$tmpday]; } else { $day = $tmpday; } $year= @timedata[5] + 1900; $spacer = "_"; $drive = "\\\\xxx\\xxxxx\\ftp\\files"; $in = "\\\\xxx\\xxxxx\\SunTrust"; $script = "\\\\xxx\\xxxxx\\Suntrust\\scripts"; $ap_script = "\\\\xxx\\xxxxxx\ap_scripts"; $payrollin = "$in\\payroll"; $oneworldin = "$in\\oneworld"; $retireein = "$in\\retiree"; $tempin = "$in\\temp"; $valid = 0; while ( $valid < 1) { # Clear the in directory before retrieving files. print `del /Q $in\\ach*.*`; $chk = 0; $dateline = "$year$month$day"; system("cls"); system("color 0A"); print "\n"; print "\n"; print " Bank Master File Send Script\n "; print "\n\n"; print "1.) Payroll ACH Send.\n\n"; print "2.) Positive Pay Send.\n\n"; print "3.) AP Positive Pay Send.\n\n"; print "4.) Echeck Send.\n\n"; print "5.) PSERM Positive Pay. \n\n"; print "6.) Payroll Retiree ACH.\n\n"; print "7.) Exit Menu.\n"; print "\n"; $chk = <STDIN>; chop ($chk); if ($chk eq "1"){ $source = "\\\\xxx\\xxxxx\\Public\\OneWor~2\\Interfaces"; $dest = $payrollin; $pgpfile = "achout.txt"; system("cls"); $avil = 0; payach(); # pulls file from dir and archives. if ($avil < 1){ print "******************************************************** +**********\n"; print "*\n"; print "* STOP STOP STOP STOP\n"; print "*\n"; print "* Verify that total matches the amount provided by pay +roll..\n"; print "*\n"; print "*\n"; print "******************************************************** +**********\n"; print "\n\n"; print ".\n"; print `perl $script\\getach.pl payroll`; print `type $dest\\distot.txt`; print `echo ************************** >> $dest\\putpayrollach. +log`; print`echo %date% %time% >> $dest\\putpayrollach.log`; pgp_file(); setup_password(); $sitenum = 17; $source_fld = "$in\\payroll"; $location_fld = "\/ACH"; $source_file = "achout.txt.pgp"; send_file(); ftp_files(); print `del $in\\payroll\\achout.txt.pgp`; } } if ($chk eq "2"){ $source = "\\\\xxxxx\\xxxxxx\\Public\\OneWor~2"; $dest = $payrollin; $pgpfile = "positive_pay.txt"; $type = "payroll"; system("cls"); $avil = 0; pospay(); # pulls file from dir and archives. if ($avil < 1){ print "******************************************************** +**********\n"; print "*\n"; print "* STOP STOP STOP STOP\n"; print "*\n"; print "* Payroll Positive Pay send..\n"; print "*\n"; print "*\n"; print "******************************************************** +**********\n"; print "\n\n"; print ".\n"; pgp_file(); setup_password(); $sitenum = 17; $source_fld = "$dest"; $location_fld = "\/Control_Pay"; $source_file = "Positive_Pay.txt.pgp"; send_file(); ftp_files(); print `del $dest\\Positive_Pay.txt.pgp`; print `del $dest\\Positive_Pay.txt`; } } if ($chk eq "3"){ $source = "\\\\xxxxx\\xxxxxx\\Public\\OneWor~1"; $dest = $oneworldin; $pgpfile = "positive_pay.txt"; $type = "Oneworld"; system("cls"); $avil = 0; pospay(); # pulls file from dir and archives. if ($avil < 1){ print "******************************************************** +**********\n"; print "*\n"; print "* STOP STOP STOP STOP\n"; print "*\n"; print "* Oneworld Positive Pay send..\n"; print "*\n"; print "*\n"; print "******************************************************** +**********\n"; print "\n\n"; print ".\n"; pgp_file(); setup_password(); $sitenum = 16; $source_fld = "$dest"; $location_fld = "\/Control_Pay"; $source_file = "Positive_Pay.txt.pgp"; send_file(); ftp_files(); print `del $dest\\Positive_Pay.txt.pgp`; print `del $dest\\Positive_Pay.txt`; } } if ($chk eq "4"){ $source = "c:\\ACH\\oneworld"; $dest = $onworldin; $pgpfile = "eCheckOW"; system("cls"); $avil = 0; OWeCheck(); # pulls file from dir and archives. if ($avil < 1){ print "******************************************************** +**********\n"; print "*\n"; print "* STOP STOP STOP STOP\n"; print "*\n"; print "* Notice the total for the Echeck file..\n"; print "*\n"; print "*\n"; print "******************************************************** +**********\n"; print "\n\n"; print ".\n"; print `perl $in\\scripts\\getach.pl oneworld`; print `type $dest\\\distot.txt`; print `echo ************************** >> $dest\\putecheck.log` +; print `echo %date% %time% >> $dest\\putecheck.log`; pgp_file(); setup_password(); $sitenum = 18; $source_fld = "$dest"; $location_fld = "\/ACH"; $source_file = "echeck.pgp"; send_file(); #ftp_files(); } } if ($chk eq "5"){ $source = "\\\\xxxxxx\\xxxxxx\\Public\\OneWor~1"; $dest = $oneworldin; $pgpfile = "positive_pay.txt"; $type = "PSERM"; system("cls"); $pserm_arch = "\\\\xxxxx\\xxxxxx\\Public\\PSERM\\Positi~1\\archive +"; $avil = 0; psermpospay(); # pulls file from dir and archives. if ($avil < 1){ print "******************************************************** +**********\n"; print "*\n"; print "* STOP STOP STOP STOP\n"; print "*\n"; print "* PSERM Positive Pay send..\n"; print "*\n"; print "*\n"; print "******************************************************** +**********\n"; print "\n\n"; print ".\n"; pgp_file(); setup_password(); $sitenum = 18; $source_fld = "$dest"; $location_fld = "\/Control_Pay"; $source_file = "Positive_Pay.txt.pgp"; send_file(); ftp_files(); print `del $dest\\Positive_Pay.txt.pgp`; print `del $dest\\Positive_Pay.txt`; } } if ($chk eq "6"){ $source = "\\\\xxxxx\\xxxxxx\\Public\\OneWor~2\\Interfaces"; $dest = $retireein; $pgpfile = "payach.txt"; system("cls"); $avil = 0; retpayach(); # pulls file from dir and archives. if ($avil < 1){ print "******************************************************** +**********\n"; print "*\n"; print "* STOP STOP STOP STOP\n"; print "*\n"; print "* Verify that total matches the amount provided by pay +roll..\n"; print "*\n"; print "*\n"; print "******************************************************** +**********\n"; print "\n\n"; print ".\n"; print `perl $in\\scripts\\getach.pl retiree`; print `type $dest\\\distot.txt`; print `echo ************************** >> $dest\\putretireeach. +log`; print`echo %date% %time% >> $dest\\putretireeach.log`; pgp_file(); setup_password(); $sitenum = 17; $source_fld = "$dest"; $location_fld = "\/ACH"; $source_file = "uapach.txt.pgp"; send_file(); ftp_files(); #print `del $dest\\uapach.txt.pgp`; } } elsif ($chk eq "7") { $valid = 1; system("color 07"); system("cls"); } else { print "Invalid Option\n"; } } sub OWeCheck{ if (-e "$source\\eCheckOW") { print `del $dest\\eCheckOW.bkup`; $achname = "eCheckOW_$month$day$year.txt"; print `copy $source\\eCheckOW $dest\\eCheckOW`; print `copy $source\\eCheckOW $dest\\echeck\\$achname`; print `move $source\\eCheckOW $dest\\eCheckOW.bak`; } else { system("cls"); system("color cf"); print "\n"; print "\n"; print "The One World eCheck file is not available.\n"; print "\n"; print "Please verify manually.\n"; print "\n"; $avil = 1; print `pause`; } } sub payach{ if (-e "$source\\payach") { print `del $dest\\achout.txt`; $achname = "payach_$month$day$year.txt"; print `copy $source\\payach $dest\\achout.txt`; print `copy $source\\payach $dest\\backup\\$achname`; print `del $dest\\backup\\payach.bak`; print `move $source\\payach $dest\\backup\\payach.bak`; } else { #system("cls"); system("color cf"); print "\n"; print "\n"; print "The Payroll Ach file is not available.\n"; print "\n"; print "Please verify manually.\n"; print "\n"; $avil = 1; print `pause`; } } sub retpayach{ if (-e "$source\\retiree_payach") { print `del $in\\payroll\\uapach.txt`; $achname = "retach_$month$day$year.txt"; print `copy $source\\retiree_payach $dest\\uapach.txt`; print `copy $source\\retiree_payach $dest\\backup\\$achname`; print `del $dest\\backup\\retach.bak`; print `move $source\\retiree_payach $dest\\backup\\retach.bak`; } else { system("cls"); system("color cf"); print "\n"; print "\n"; print "The Retiree Ach file is not available.\n"; print "\n"; print "Please verify manually.\n"; print "\n"; $avil = 1; print `pause`; } } sub pospay{ if (-e "$source\\Interfaces\\positive_pay.txt") { print `copy $source\\Interfaces\\positive_pay.txt $dest\\positive_ +pay.txt`; print `copy $source\\Interfaces\\positive_pay.txt $source\\Archive +-positive-pay\\$type\_positive\_pay\_$month$day$year.dat`; print `del $source\\Interfaces\\positive_pay.txt`; } else { system("cls"); system("color cf"); print "\n"; print "\n"; print "There is no Positive Pay file available.\n"; print "\n"; print "Please verify manually.\n"; print "\n"; $avil = 1; print `pause`; } } sub psermpospay{ if (-e "$source\\Interfaces\\positive_pay.txt") { print `copy $source\\Interfaces\\positive_pay.txt $dest\\positive_ +pay.txt`; print `copy $source\\Interfaces\\positive_pay.txt $pserm_arch\\$ty +pe\_positive\_pay\_$month$day$year.dat`; print `del $source\\Interfaces\\positive_pay.txt`; } else { system("cls"); system("color cf"); print "\n"; print "\n"; print "There is no PSERM Positive Pay file available.\n"; print "\n"; print "Please verify manually.\n"; print "\n"; $avil = 1; print `pause`; } } sub setup_password { #obtain password information for the two remote sites. @passline = (Num1,Site1,User1,Pswd1); open(PASS,"$drive\\password.ctl") || die "cannot open password ctl file....."; @pass_ctl=<PASS>; close(PASS); foreach $pass (@pass_ctl) { $len = length($pass); if ($len > 1) { @passline = split(/\|/, $pass); $num = $passline[0]; $numint = int($num); @site[$numint] = $passline[1]; @userid[$numint] = $passline[2]; @pswd[$numint] = $passline[3]; } } } sub send_file { # Create the text file for sending files to Bank. open(OUT,">$script\\ftp_put_suntrust.txt") || die "cannot open ftp text file"; print OUT "@userid[$sitenum]\n"; print OUT "@pswd[$sitenum]\n"; print OUT "binary\n"; print OUT "lcd $source_fld\n"; print OUT "cd $location_fld\n"; print OUT "mput $source_file\n"; print OUT "bye\n"; close OUT; } sub pgp_file{ print `pgp --encrypt $dest\\$pgpfile --user \"xxxxxx\" --output $dest +\\$pgpfile.pgp --conventional-passphrase \"xxxxxxxxxx\"`; } sub ftp_files { print `ftp -i -s:$script\\ftp_put_suntrust.txt @site[$sitenum]`; }

In reply to Re: Has my Perl Go Crazy? by Xanthis013
in thread Has my Perl Go Crazy? by Xanthis013

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.