Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: Re: files

by SarahM (Monk)
on Jun 14, 2002 at 20:21 UTC ( [id://174722]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: files
in thread Read and Combine Range of Two Files (was files)

That is different, but it isn't too hard...first, you need to use CGI.pm, then you get a list of the files, open them and write them out to another file. Here is an example...your webform will need one input named 'outfile' for the file you want to save to. You will also need a series of inputs named 'fileX' where 'X' is a number, one for each input file.

WARNING!!! This example doesn't use taint in order to make it more readable. In a real script you should always use taint.

use CGI; my $q = new CGI; # Get a CGI object open (OUT, ">$q->param('outfile')") || die $!; # Open our output file my @files = grep{/^file\d+$/} $q->param(); # Grab a list of params for my $filename (@files){ open (IN, $q->param($filename)) || die $!; # Open each input file print OUT <IN>; # Print the input file to the output file close (IN); # Make sure you close the input file } close (OUT);

Replies are listed 'Best First'.
Re: Re: Re: Re: files
by A_CAR11 (Initiate) on Jun 14, 2002 at 20:42 UTC
    Ok. But the interface for this program has two select menus that read the directory where the files are stored and they're dynamically populated on each select menu. From there one choice of file is made from one of the select menu and other from the other select menu, by clicking on the submit bottom the code behind will process the range of the files selected and it will get displayed to the browser. Thank you so far, sorry if I am driving you crazy with this. Just want to get this clear as possible.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-20 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found