Professional Web Applications Themes

Re Finding file - PERL Beginners

Hi This is what I'm using to find the file. .I still can't delete the file or replace it with the file I created. Help pls Thanx se strict; use File::Find; use CGI qw(:standard); my $query = param("Toetsss"); undef $/; find( sub { return if($_ =~ /^\./); return unless($_ =~ /Toetsss.txt/i); stat $File::Find::name; return if -d; return unless -r; open(FILE, "< $File::Find::name") or return; my $string = <FILE>; close (FILE); print "$File::Find::name\n"; }, 'c:\Doents and Settings');...

  1. #1

    Default Re Finding file

    Hi

    This is what I'm using to find the file. .I still can't delete the
    file or replace it with the file I created.

    Help pls Thanx

    se strict;
    use File::Find;
    use CGI qw(:standard);
    my $query = param("Toetsss");
    undef $/;

    find( sub
    {
    return if($_ =~ /^\./);
    return unless($_ =~ /Toetsss.txt/i);
    stat $File::Find::name;
    return if -d;
    return unless -r;

    open(FILE, "< $File::Find::name") or return;
    my $string = <FILE>;
    close (FILE);


    print "$File::Find::name\n";

    },
    'c:\Doents and Settings');


    Charlene Guest

  2. #2

    Default Re: Re Finding file

    Charlene Gentle wrote: 

    Hello,
     

    perldoc -f unlink

     

    perldoc File::Copy

     

    You are stat()ing the same file a second time.
     

    You are stat()ing the same file a third time.
    Use the _ special filehandle to avoid stating the same file more than once.

    stat;
    return if -d _;
    return unless -r _;

     


    John
    --
    use Perl;
    program
    fulfillment
    John Guest

  3. #3

    Default RE: Re Finding file



    I don't seen anywhere in this script where you actually attempt to delete or
    rename anything
    Did I miss something? and why are you trying to open the file, if you are
    just trying to delete or rename it?

    perldoc -f unlink
    perldoc -f rename

    Thanks,
    Jim






    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.772 / Virus Database: 519 - Release Date: 10/1/2004


    Jim Guest

Similar Threads

  1. finding a file by name
    By joonstar in forum Macromedia ColdFusion
    Replies: 0
    Last Post: April 7th, 09:49 PM
  2. Finding a file
    By Charlene in forum PERL Beginners
    Replies: 2
    Last Post: October 7th, 12:58 PM
  3. Finding a string in a file
    By Debbie in forum PERL Beginners
    Replies: 3
    Last Post: May 25th, 11:20 PM
  4. finding a spot in a file
    By John W. Krahn in forum PERL Beginners
    Replies: 3
    Last Post: October 10th, 02:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139