aghajawad has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: PERL File Manipulation
by Abigail-II (Bishop) on Jul 11, 2003 at 07:21 UTC
    Well, it depends. Are you sure it's the Perl program that is the bottleneck? If the files are large, it may well be that the disk I/O or the terminal I/O is the bottleneck.

    But if you want people to look at your code, you have to post it. But mind! If you cut-and-post hundreds of lines of code without much explaination, you are far less likely to get a useful response as when you post the relevant lines of the program, among with commentary.

    Abigail

Re: PERL File Manipulation
by tos (Deacon) on Jul 11, 2003 at 08:59 UTC
    here one possible perl approach for your problem. But regard what Abigail-II mentioned about the I/O-bottleneck.

    use strict; use warnings; opendir (D,"."); #current working directory while (my $f = readdir(D)) { next unless -T $f; #only textfiles print $f,"\n"; open (F, $f); while (<F>) { print; } }
    greetings, tos
Re: PERL File Manipulation
by nysus (Parson) on Jul 11, 2003 at 06:48 UTC
    The answer is yes, someone can help you. You've come to the best place on the net for questions about Perl. However, you are going to need to supply many more specifics. First what are you doing to the files?

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff";
    $nysus = $PM . $MCF;
    Click here if you love Perl Monks

Re: PERL File Manipulation
by wufnik (Friar) on Jul 11, 2003 at 06:52 UTC
    hmmm

    maybe i am misinterpreteing, but the following displays all files on screen in a directory for me.

    perl -ne 'print' *


    regards,

    ...wufnik

    -- in the world of the mules there are no rules
      I get a "Can't open *: Invalid argument." error from my Windows XP machine on that one.

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff";
      $nysus = $PM . $MCF;
      Click here if you love Perl Monks

        That'll be the old globbing thing then :-) Weirdly however it doesn't work either if you supply a valid filename instead of '*' - of course if you change the quotes to double ones it works fine. An illustration of the cranky nature of cmd.exe

        /J\
        
        perl -ne "print" *.*

        --
        Allolex