OK so I have a script that I run find in Perl on my Mac, but now the boss wants it on his windows server. He wants to have access to it if I am not in the office. I got ActivePerl running fine and have been able to fix most of what is alling the script, like it does the most of what it is intended to do but I can figure out why the dir command and copy command are not working. I would gladly use opendir,readdir and close dir but had much less work with them.
#!/usr/bin/perl #macc auto format use warnings; use strict; use Shell qw( perl ); use Shell qw( dir ); use Shell qw( copy ); use Shell qw( del ); use Shell qw( cd ); system( "cd d:" ); system( "dir tmp/*.txt" ); my ($file, $list, $output, $copy, $backup, $remove, $orgin); $list = "dir tmp/*.txt"; $output = $list; print "$list"; print "Enter File Name to be converted.\n"; print "File should be in this directory.\n"; $file = <STDIN>; chomp($file); $copy = copy "/perl/$file /tmp/$file "; sleep 3; open my $IN, "<", $file or die "can't open $file: $!"; print "Staring Edits...1."; perl "/perl/macc1", "/tmp/$file"; sleep 2; print ",13.\n"; perl "/perl/macc13", "/tmp/$file"; print "Edits complete.\n"; print "Do you wish to keep the edits?\n"; print "Enter Yes or No.\n"; &answer(); sub answer() { $backup = <STDIN>; SWITCH: for ($backup) { /^(y|yes)$/i && do { del "/perl/$file"; last SWITCH; }; /^(n|no)$/i && do { copy "/perl/$file /tmp/$file", del "/perl/$file"; last SWITCH; }; #$remove = del "/perl/$file"; #$orgin = copy "/perl/$file /tmp/$file"; # Validate user input and return message if invalid print "\n\n=====================================\n"; print "You Have Entered and Incorrect Option\n"; print "Valid Options are [Y/N]\n"; print "=====================================\n\n"; &answer; } }
Thank you for any help. James734

In reply to ActivePERL is the devil? by james734

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.