Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: file copy undefined?

by ikegami (Patriarch)
on Apr 14, 2009 at 16:15 UTC ( [id://757431]=note: print w/replies, xml ) Need Help??


in reply to file copy undefined?

Problems you didn't get around to noticing yet:
  • @files=split / /,$file;
    makes no sense. Why would you divide the file name into bits, and treat the bits as file names. You want
    push @files, $file;

  • copy copies a file, it doesn't open it for reading. If you wish to copy the file, use copy. If you wish to read from the file, use open. If you wish to do both, use both. copy does not take three arguments.

  • while ($line = <INPUT>) if used to iterate through the lines of a file.

use strict; use warnings; my $dir_qfn = "C:\\inetpub\\performancetesting\\output\\new\\mlx\\aar" +; opendir(my $dh, $dir_qfn) or die("Can't read dir $dir_qfn: $!\n"); while (defined(my $fn = readdir($dh)) ) { my $qfn = "$dir_qfn/$fn"; next if !-f $qfn; open(my $fh, '<', $qfn) or do { warn("Can't open file $qfn: $!\n"); next; }; while (<$fh>) { chomp; printf("%03d: %s\n", $., $_); } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://757431]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (1)
As of 2024-04-25 00:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found