Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] file help needed

Expand Messages
  • Lou Hernsen
    OK thanks What size file is considered large? I am writing an online game.. still... after 3 years and several rewrites as I learn more.. If nothing else its
    Message 1 of 20 , Oct 10, 2007
    • 0 Attachment
      OK thanks
      What size file is considered large?
      I am writing an online game.. still... after 3 years
      and several rewrites as I learn more..
      If nothing else its been fun and keeps my brain sharp.



      ----- Original Message -----
      From: "Jenda Krynicky" <Jenda@...>
      To: <perl-beginner@yahoogroups.com>
      Sent: Wednesday, October 10, 2007 12:07 PM
      Subject: Re: [PBML] file help needed


      > From: "Lou Hernsen" <lhernsen1015@...>
      > > I have reviewed how to use SEEK, TELL, GETC and I am able to use them
      quite
      > > well.
      > > I was hoping that GETC might have a command like $VAR = GETC(FILE,
      position,
      > > length);
      > > I was hoping for a command closer to how substr(string, position,
      length)
      > > works...
      >
      > 300*300 is not that much, if you know how to do it using substr(),
      > read the whole file and use the substr() :-)
      >
      > Jenda
      > ===== Jenda@... === http://Jenda.Krynicky.cz =====
      > When it comes to wine, women and song, wizards are allowed
      > to get drunk and croon as much as they like.
      > -- Terry Pratchett in Sourcery
      >
      >
      >
      > Unsubscribing info is here:
      http://help.yahoo.com/help/us/groups/groups-32.html
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      >
      > --
      > No virus found in this incoming message.
      > Checked by AVG Free Edition.
      > Version: 7.5.472 / Virus Database: 269.14.6/1061 - Release Date: 10/10/07
      8:43 AM
      >
      >
    • aditi gupta
      Hello All, I wrote a code to read the contents of a directory and then do something to the .txt files in it. The problem is that the code is not recognizing
      Message 2 of 20 , Oct 10, 2007
      • 0 Attachment
        Hello All,

        I wrote a code to read the contents of a directory and then do something to the .txt files in it. The problem is that the code is not recognizing the files present in the directory.

        ==== CODE BEGINS ====
        1 #!/usr/bin/perl -w
        2
        3 use strict;
        4
        5 print "enter dir name:";
        6 my $dirname = <STDIN>;
        7 chomp $dirname;
        8
        9 opendir (DIR, "$dirname") or die "couldn't open $dirname: $!\n";
        10
        11 my @list = readdir(DIR);
        12 closedir(DIR);
        13 print "Files present are: @list\n";
        14 foreach my $file (@list) {
        15 if ($file =~ /\.txt$/) {
        16 print "file name is $file";
        17 open (FH, "$file") or die "couldn't open file:$file : $!\n";
        18 open (OUT, ">$file.random") or die "couldn't open outfile\n";
        19
        20 while (<FH>) {
        21 $_ =~ s/^>.*/\n/;
        22 $_ =~ s/\n\n/-/;
        23 $_ =~ s/\n//;
        24 $_ =~ s/-/\n/;
        25 print OUT $_;
        26 }
        27 }
        28 }

        ==== CODE ENDS ====

        When I run it, I see the following:

        >pre.pl
        enter dir name:5S_ribosomal_seq
        Files present are: . .. A.txt B.txt C.txt
        couldn't open file:A.txt : No such file or directory
        file name is A.txt
        ---------------------------
        I don't understand why it is not recognizing A.txt.
        Also, the program should have died after printing the error message "No such file or directory", but it prints line 16. Is the flow of the program not right? The code doesn't return any errors or warnings.

        When I tried to debug the code, I get:

        main::(pre.pl:5): print "enter dir name:";
        DB<1> 5S_ribosomal_seq
        Bareword found where operator expected at (eval 25)
        ---------------------------------------------------------------------------

        Again, I didn't understand why is an operator expected, when all I'm doing is entering the directory name.

        I'd be obliged if anyone can identify what I;m doing wrong.

        Thank You!
        Aditi




        ---------------------------------
        Get the freedom to save as many mails as you wish. Click here to know how.

        [Non-text portions of this message have been removed]
      • Jeff Pinyan
        ... Right here is your problem. The variable $file only holds the NAME of the file, not the PATH to it. You re not in the directory where $file exists, you
        Message 3 of 20 , Oct 10, 2007
        • 0 Attachment
          On 10/10/07, aditi gupta <aditi9783@...> wrote:
          > I wrote a code to read the contents of a directory and then do something to the .txt files in it. The problem is that the code is not recognizing the files present in the directory.
          >
          > ==== CODE BEGINS ====
          > 1 #!/usr/bin/perl -w
          > 2
          > 3 use strict;
          > 4
          > 5 print "enter dir name:";
          > 6 my $dirname = <STDIN>;
          > 7 chomp $dirname;
          > 8
          > 9 opendir (DIR, "$dirname") or die "couldn't open $dirname: $!\n";
          > 10
          > 11 my @list = readdir(DIR);
          > 12 closedir(DIR);
          > 13 print "Files present are: @list\n";
          > 14 foreach my $file (@list) {
          > 15 if ($file =~ /\.txt$/) {
          > 16 print "file name is $file";
          > 17 open (FH, "$file") or die "couldn't open file:$file : $!\n";

          Right here is your problem. The variable $file only holds the NAME of
          the file, not the PATH to it. You're not in the directory where $file
          exists, you need to use "$dirname/$file" to get the file.

          opendir my $dh, $dirname or die "can't readdir $dirname: $!";
          my @files = readdir $dh;
          closedir $dh;

          for my $file (@files) {
          if ($file =~ /\.txt$/) {
          open my $in_fh, "<", "$dirname/$file" or die "can't read
          $dirname/$file: $!";
          open my $out_fh, ">", "$dirname/$file.random" or die "can't
          write $dirname/$file.random: $!";
          ...
          }
          }

          --
          [Mary said,] "Do whatever he tells you." ~ John 2:5
        • Jenda Krynicky
          From: Lou Hernsen ... Depends. Depends on the type of file, what you do with it, how much physical memory do you have,
          Message 4 of 20 , Oct 10, 2007
          • 0 Attachment
            From: "Lou Hernsen" <lhernsen1015@...>
            > OK thanks
            > What size file is considered large?

            Depends. Depends on the type of file, what you do with it, how much
            physical memory do you have, etc. etc. etc. There is no definite
            answer.

            When it comes to the viability of slurping a file, I'd think slurping
            a single 1MB file is quite OK if processing it in chunks would be
            tedious.

            Jenda
            ===== Jenda@... === http://Jenda.Krynicky.cz =====
            When it comes to wine, women and song, wizards are allowed
            to get drunk and croon as much as they like.
            -- Terry Pratchett in Sourcery
          • Janice Williams
            Since this is a beginner thread, may I please ask what slurp means? I looked on perl doc and google, but the meaning still escapes me. thanks, Jan ... From:
            Message 5 of 20 , Oct 10, 2007
            • 0 Attachment
              Since this is a beginner thread, may I please ask what slurp means?
              I looked on perl doc and google, but the meaning still escapes me.
              thanks,
              Jan



              ----- Original Message ----
              From: Jenda Krynicky <Jenda@...>
              To: perl-beginner@yahoogroups.com
              Sent: Wednesday, October 10, 2007 5:15:45 PM
              Subject: Re: [PBML] file help needed













              From: "Lou Hernsen" <lhernsen1015@ wowway.com>

              > OK thanks

              > What size file is considered large?



              Depends. Depends on the type of file, what you do with it, how much

              physical memory do you have, etc. etc. etc. There is no definite

              answer.



              When it comes to the viability of slurping a file, I'd think slurping

              a single 1MB file is quite OK if processing it in chunks would be

              tedious.



              Jenda

              ===== Jenda@Krynicky. cz === http://Jenda. Krynicky. cz =====

              When it comes to wine, women and song, wizards are allowed

              to get drunk and croon as much as they like.

              -- Terry Pratchett in Sourcery














              <!--



              #ygrp-mkp{
              border:1px solid #d8d8d8;font-family:Arial;margin:14px 0px;padding:0px 14px;}
              #ygrp-mkp hr{
              border:1px solid #d8d8d8;}
              #ygrp-mkp #hd{
              color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px 0px;}
              #ygrp-mkp #ads{
              margin-bottom:10px;}
              #ygrp-mkp .ad{
              padding:0 0;}
              #ygrp-mkp .ad a{
              color:#0000ff;text-decoration:none;}
              -->



              <!--



              #ygrp-sponsor #ygrp-lc{
              font-family:Arial;}
              #ygrp-sponsor #ygrp-lc #hd{
              margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
              #ygrp-sponsor #ygrp-lc .ad{
              margin-bottom:10px;padding:0 0;}
              -->



              <!--



              #ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
              #ygrp-mlmsg table {font-size:inherit;font:100%;}
              #ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, sans-serif;}
              #ygrp-mlmsg pre, code {font:115% monospace;}
              #ygrp-mlmsg * {line-height:1.22em;}
              #ygrp-text{
              font-family:Georgia;}
              #ygrp-text p{
              margin:0 0 1em 0;}
              #ygrp-tpmsgs{
              font-family:Arial;clear:both;}
              #ygrp-vitnav{
              padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
              #ygrp-vitnav a{
              padding:0 1px;}
              #ygrp-actbar{
              clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
              #ygrp-actbar .left{
              float:left;white-space:nowrap;}
              .bld{font-weight:bold;}
              #ygrp-grft{
              font-family:Verdana;font-size:77%;padding:15px 0;}
              #ygrp-ft{
              font-family:verdana;font-size:77%;border-top:1px solid #666;padding:5px 0;}
              #ygrp-mlmsg #logo{
              padding-bottom:10px;}

              #ygrp-vital{
              background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
              #ygrp-vital #vithd{
              font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
              #ygrp-vital ul{
              padding:0;margin:2px 0;}
              #ygrp-vital ul li{
              list-style-type:none;clear:both;border:1px solid #e0ecee;}
              #ygrp-vital ul li .ct{
              font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-right:.5em;}
              #ygrp-vital ul li .cat{
              font-weight:bold;}
              #ygrp-vital a{
              text-decoration:none;}

              #ygrp-vital a:hover{
              text-decoration:underline;}

              #ygrp-sponsor #hd{
              color:#999;font-size:77%;}
              #ygrp-sponsor #ov{
              padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
              #ygrp-sponsor #ov ul{
              padding:0 0 0 8px;margin:0;}
              #ygrp-sponsor #ov li{
              list-style-type:square;padding:6px 0;font-size:77%;}
              #ygrp-sponsor #ov li a{
              text-decoration:none;font-size:130%;}
              #ygrp-sponsor #nc{
              background-color:#eee;margin-bottom:20px;padding:0 8px;}
              #ygrp-sponsor .ad{
              padding:8px 0;}
              #ygrp-sponsor .ad #hd1{
              font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
              #ygrp-sponsor .ad a{
              text-decoration:none;}
              #ygrp-sponsor .ad a:hover{
              text-decoration:underline;}
              #ygrp-sponsor .ad p{
              margin:0;}
              o{font-size:0;}
              .MsoNormal{
              margin:0 0 0 0;}
              #ygrp-text tt{
              font-size:120%;}
              blockquote{margin:0 0 0 4px;}
              .replbq{margin:4;}
              -->








              [Non-text portions of this message have been removed]
            • merlyn@stonehenge.com
              ... Janice Since this is a beginner thread, may I please ask what slurp means? It s an english word, which is why it s not on perldoc. Have you never heard of
              Message 6 of 20 , Oct 10, 2007
              • 0 Attachment
                >>>>> "Janice" == Janice Williams <janicew3@...> writes:

                Janice> Since this is a beginner thread, may I please ask what slurp means?

                It's an english word, which is why it's not on perldoc.

                Have you never heard of slurping?

                --
                Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
                <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
                Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
                See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
              • Lou Hernsen
                Slurping is basically to suck all the data into a var or array ....Like a vampire draining the life force... as opposed to using a selective tool like MySQL
                Message 7 of 20 , Oct 10, 2007
                • 0 Attachment
                  Slurping is basically to suck all the data into a var or array
                  ....Like a vampire draining the life force...
                  as opposed to using a selective tool like MySQL
                  which dances daintily around a file selectively tickling its bits.. and
                  bites.....
                  sorry.. saw a Monty Python movie tonight....
                  cheers


                  ----- Original Message -----
                  From: <merlyn@...>
                  To: "Janice Williams" <janicew3@...>
                  Cc: <perl-beginner@yahoogroups.com>
                  Sent: Wednesday, October 10, 2007 10:53 PM
                  Subject: Re: [PBML] file help needed


                  > >>>>> "Janice" == Janice Williams <janicew3@...> writes:
                  >
                  > Janice> Since this is a beginner thread, may I please ask what slurp
                  means?
                  >
                  > It's an english word, which is why it's not on perldoc.
                  >
                  > Have you never heard of slurping?
                  >
                  > --
                  > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
                  0095
                  > <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
                  > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
                  > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
                  training!
                  >
                  >
                  > Unsubscribing info is here:
                  http://help.yahoo.com/help/us/groups/groups-32.html
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                  >
                  >
                  > --
                  > No virus found in this incoming message.
                  > Checked by AVG Free Edition.
                  > Version: 7.5.472 / Virus Database: 269.14.6/1061 - Release Date: 10/10/07
                  8:43 AM
                  >
                  >
                • Jenda Krynicky
                  From: Janice Williams ... Sorry. To slurp a file means to read all its contents in one go, store them in a scalar or array and only then
                  Message 8 of 20 , Oct 11, 2007
                  • 0 Attachment
                    From: Janice Williams <janicew3@...>
                    > Since this is a beginner thread, may I please ask what slurp means?
                    > I looked on perl doc and google, but the meaning still escapes me.
                    > thanks,
                    > Jan

                    Sorry. To slurp a file means to read all its contents in one go,
                    store them in a scalar or array and only then start to process the
                    data.

                    The other basic option is to loop reading individual lines or records
                    (often called chunks), processing them and then throwing away.

                    The later generally uses less memory, but sometimes there is no good
                    definition of lines/records or you need to search over the
                    line/record boundary so it makes the code more complex. Because you
                    have to make sure you find even the occurences that start in one
                    record and end in another.

                    So sometimes "slurping" the whole file and working with a single
                    scalar is easier. And if the file is not too big, it's a good
                    solution.

                    HTH, Jenda
                    ===== Jenda@... === http://Jenda.Krynicky.cz =====
                    When it comes to wine, women and song, wizards are allowed
                    to get drunk and croon as much as they like.
                    -- Terry Pratchett in Sourcery
                  • Jeff Pinyan
                    ... The only problem is that none of the standard definitions for the word slurp (that is, before it was hijacked by hackers) is similar to the definition it
                    Message 9 of 20 , Oct 11, 2007
                    • 0 Attachment
                      On 10/10/07, merlyn@... <merlyn@...> wrote:
                      >
                      > >>>>> "Janice" == Janice Williams <janicew3@...> writes:
                      >
                      > Janice> Since this is a beginner thread, may I please ask what slurp means?
                      >
                      > It's an english word, which is why it's not on perldoc.
                      >
                      > Have you never heard of slurping?

                      The only problem is that none of the standard definitions for the word
                      "slurp" (that is, before it was hijacked by hackers) is similar to the
                      definition it has in a programming context.

                      slurp (slûrp)
                      v., slurped, slurp·ing, slurps.
                      v.tr.
                      To eat or drink noisily.
                      v.intr.
                      To eat or drink something noisily.
                      n.
                      1. A loud sucking noise made in eating or drinking.
                      2. Slang. A mouthful of a liquid: took a slurp of grape juice.

                      It doesn't mean "to consume an entire food or drink all at once, in
                      one gulp". Contrast that with the hacker definition:

                      To read a large data file entirely into core before working on it.
                      This may be contrasted with the strategy of reading a small piece at a
                      time, processing it, and then reading the next piece. "This program
                      slurps in a 1K-by-1K matrix and does an FFT."

                      --
                      [Mary said,] "Do whatever he tells you." ~ John 2:5
                    • Janice Williams
                      Randall, To answer your question. No. Thanks everyone else for the nice and helpful answers. Jan ... From: merlyn@stonehenge.com To:
                      Message 10 of 20 , Oct 11, 2007
                      • 0 Attachment
                        Randall,

                        To answer your question.

                        No.

                        Thanks everyone else for the nice and helpful answers.

                        Jan



                        ----- Original Message ----
                        From: "merlyn@..." <merlyn@...>
                        To: Janice Williams <janicew3@...>
                        Cc:
                        perl-beginner@yahoogroups.com
                        Sent: Wednesday, October 10, 2007 7:53:09 PM
                        Subject: Re: [PBML] file help needed













                        >>>>> "Janice" == Janice Williams <janicew3@yahoo. com> writes:



                        Janice> Since this is a beginner thread, may I please ask what slurp means?



                        It's an english word, which is why it's not on perldoc.



                        Have you never heard of slurping?



                        --

                        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095

                        <merlyn@stonehenge. com> <URL:http://www.stonehen ge.com/merlyn/>

                        Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.

                        See PerlTraining. Stonehenge. com for onsite and open-enrollment Perl training!












                        <!--



                        #ygrp-mkp{
                        border:1px solid #d8d8d8;font-family:Arial;margin:14px 0px;padding:0px 14px;}
                        #ygrp-mkp hr{
                        border:1px solid #d8d8d8;}
                        #ygrp-mkp #hd{
                        color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px 0px;}
                        #ygrp-mkp #ads{
                        margin-bottom:10px;}
                        #ygrp-mkp .ad{
                        padding:0 0;}
                        #ygrp-mkp .ad a{
                        color:#0000ff;text-decoration:none;}
                        -->



                        <!--



                        #ygrp-sponsor #ygrp-lc{
                        font-family:Arial;}
                        #ygrp-sponsor #ygrp-lc #hd{
                        margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
                        #ygrp-sponsor #ygrp-lc .ad{
                        margin-bottom:10px;padding:0 0;}
                        -->



                        <!--



                        #ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
                        #ygrp-mlmsg table {font-size:inherit;font:100%;}
                        #ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, sans-serif;}
                        #ygrp-mlmsg pre, code {font:115% monospace;}
                        #ygrp-mlmsg * {line-height:1.22em;}
                        #ygrp-text{
                        font-family:Georgia;}
                        #ygrp-text p{
                        margin:0 0 1em 0;}
                        #ygrp-tpmsgs{
                        font-family:Arial;clear:both;}
                        #ygrp-vitnav{
                        padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
                        #ygrp-vitnav a{
                        padding:0 1px;}
                        #ygrp-actbar{
                        clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
                        #ygrp-actbar .left{
                        float:left;white-space:nowrap;}
                        .bld{font-weight:bold;}
                        #ygrp-grft{
                        font-family:Verdana;font-size:77%;padding:15px 0;}
                        #ygrp-ft{
                        font-family:verdana;font-size:77%;border-top:1px solid #666;padding:5px 0;}
                        #ygrp-mlmsg #logo{
                        padding-bottom:10px;}

                        #ygrp-vital{
                        background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
                        #ygrp-vital #vithd{
                        font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
                        #ygrp-vital ul{
                        padding:0;margin:2px 0;}
                        #ygrp-vital ul li{
                        list-style-type:none;clear:both;border:1px solid #e0ecee;}
                        #ygrp-vital ul li .ct{
                        font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-right:.5em;}
                        #ygrp-vital ul li .cat{
                        font-weight:bold;}
                        #ygrp-vital a{
                        text-decoration:none;}

                        #ygrp-vital a:hover{
                        text-decoration:underline;}

                        #ygrp-sponsor #hd{
                        color:#999;font-size:77%;}
                        #ygrp-sponsor #ov{
                        padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
                        #ygrp-sponsor #ov ul{
                        padding:0 0 0 8px;margin:0;}
                        #ygrp-sponsor #ov li{
                        list-style-type:square;padding:6px 0;font-size:77%;}
                        #ygrp-sponsor #ov li a{
                        text-decoration:none;font-size:130%;}
                        #ygrp-sponsor #nc{
                        background-color:#eee;margin-bottom:20px;padding:0 8px;}
                        #ygrp-sponsor .ad{
                        padding:8px 0;}
                        #ygrp-sponsor .ad #hd1{
                        font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
                        #ygrp-sponsor .ad a{
                        text-decoration:none;}
                        #ygrp-sponsor .ad a:hover{
                        text-decoration:underline;}
                        #ygrp-sponsor .ad p{
                        margin:0;}
                        o{font-size:0;}
                        .MsoNormal{
                        margin:0 0 0 0;}
                        #ygrp-text tt{
                        font-size:120%;}
                        blockquote{margin:0 0 0 4px;}
                        .replbq{margin:4;}
                        -->








                        [Non-text portions of this message have been removed]
                      • aditi gupta
                        That Worked! Thank You! :) ... Right here is your problem. The variable $file only holds the NAME of the file, not the PATH to it. You re not in the
                        Message 11 of 20 , Oct 11, 2007
                        • 0 Attachment
                          That Worked! Thank You! :)

                          Jeff Pinyan <japhy.734@...> wrote: On 10/10/07, aditi gupta <aditi9783@...> wrote:
                          > I wrote a code to read the contents of a directory and then do something to the .txt files in it. The problem is that the code is not recognizing the files present in the directory.
                          >
                          > ==== CODE BEGINS ====
                          > 1 #!/usr/bin/perl -w
                          > 2
                          > 3 use strict;
                          > 4
                          > 5 print "enter dir name:";
                          > 6 my $dirname = <STDIN>;
                          > 7 chomp $dirname;
                          > 8
                          > 9 opendir (DIR, "$dirname") or die "couldn't open $dirname: $!\n";
                          > 10
                          > 11 my @list = readdir(DIR);
                          > 12 closedir(DIR);
                          > 13 print "Files present are: @list\n";
                          > 14 foreach my $file (@list) {
                          > 15 if ($file =~ /\.txt$/) {
                          > 16 print "file name is $file";
                          > 17 open (FH, "$file") or die "couldn't open file:$file : $!\n";

                          Right here is your problem. The variable $file only holds the NAME of
                          the file, not the PATH to it. You're not in the directory where $file
                          exists, you need to use "$dirname/$file" to get the file.

                          opendir my $dh, $dirname or die "can't readdir $dirname: $!";
                          my @files = readdir $dh;
                          closedir $dh;

                          for my $file (@files) {
                          if ($file =~ /\.txt$/) {
                          open my $in_fh, "<", "$dirname/$file" or die "can't read
                          $dirname/$file: $!";
                          open my $out_fh, ">", "$dirname/$file.random" or die "can't
                          write $dirname/$file.random: $!";
                          ...
                          }
                          }

                          --
                          [Mary said,] "Do whatever he tells you." ~ John 2:5





                          ---------------------------------
                          Chat on a cool, new interface. No download required. Click here.

                          [Non-text portions of this message have been removed]
                        • Syamanthaka Balakrishnan
                          Hello friends, I was planning to buy some reference books for perl based system programming. Thought I would mail you all to get some suggestions on
                          Message 12 of 20 , Oct 15, 2007
                          • 0 Attachment
                            Hello friends,

                            I was planning to buy some reference books for perl based system programming. Thought I would mail you all to get some suggestions on titles/authors which would help ppl like me, with more examples, more real time scenarios etc. More to do with servers, networks etc, in relavance with perl. Any help, guidance would be grately appriciated. Online tutorial links would also help me widen my study. I have done a basic search on google and i found few links, which were slides of a classroom based lesson. It was really nice slide, listing jists, imp points etc. If any of you hav come across such good links, it would be really nice if you could put them up for reference :).
                            Thank you in advance
                            Regards,
                            Syama


                            ---------------------------------
                            Building a website is a piece of cake.
                            Yahoo! Small Business gives you all the tools to get online.

                            [Non-text portions of this message have been removed]
                          Your message has been successfully submitted and would be delivered to recipients shortly.