Hi I am new to perl and writing my first script I want to move *.txt files from one folder to another and input output folders are input , have wrote the script as below but getting errors. can anybody help here
use Getopt::Std; $usemsg = "Usage: pre_DAD.pl -i <input_folder> -w <working_dir> -o <o +utput_file> \n"; getopts('i:o:w:', \%options); if ((!exists $options{i}) || (!exists $options{o}) || (!exists $option +s{w}) ) { die $usemsg; } $inputfolder = $options{i}; $outputfile = $options{o}; $workingdir = $options{w}; #open the input directory to get a file list opendir(my $indir, $inputfolder) || die "Can't open input directory $i +nputfolder $! \n"; while (readdir $indir) { if ($_ =~ /txt$/){ my $tfn = "/".$_; move ($inputfolder.$tfn,$workingdir); } } # close the input directory closedir $indir;

In reply to compile error in perl script by kks_perlnewbie

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.