SEARCH YOUR SOLUTION HERE  

copying multiple files

hello all, How can i copy files with a particular extension. For eg: I am using copy ("$HOME_DIR/file1.txt" ,"$LOCAL_DIR/") or warn "Cannot copy file: $!"; to copy a file, but if i have to copy all the files with the ...

Posted On: Monday 26th of November 2012 08:48:15 PM Total Views:  455
View Complete with Replies




Related Messages:

DBI:mysql how to do multiple inserts/modification?   (284 Views)
How can I do multiple database modifications without writing too much code For a single modification, I would write: $SQL = "INSERT INTO aaaaa.."; $db->do($SQL); How can I do it without repeating "$db->do($SQL);" each time Something like this throws an error, so obviously I must be missing something. $SQL = "INSERT INTO aaaaa... ; INSERT INTO bbbbb... ; INSERT INTO bbbbb... ;"; $db->do($SQL); -- Tomasz Chmielewski http://wpkg.org , Paul Lalli schrieb: > On Feb 13, 9:03 am, Tomasz Chmielewski > wrote: >> How can I do multiple database modifications without writing too much code >> >> For a single modification, I would write: >> >> $SQL = "INSERT INTO aaaaa.."; >> $db->do($SQL); >> >> How can I do it without repeating "$db->do($SQL);" each time >> >> Something like this throws an error, so obviously I must be missing >> something. >> >> $SQL = "INSERT INTO aaaaa... ; >> INSERT INTO bbbbb... ; >> INSERT INTO bbbbb... ;"; >> $db->do($SQL); > > uh. How about... > > for my $stmt (split /;\n/, $SQL) { > $db->do($stmt); > } Ah, that simple.
How to extract Min and Max value from multiple rows   (170 Views)
i am very new to PERL. I need to find Min and Max values for different ID (4,5,6) in multiple rows. eg: 13976 14249 414306 14416 415094 15651 416111 16236 516367 16643 519092 19624 519683 20561 521204 22151 622217 22765 6This data is in data.dat file. The result should be:Min 13976 and Max 15651 for ID 4Min 16111 and Max 20561 for ID 5Min 21204 and Max 22765 for ID 6How to do this in PER
writing to multiple file handles at once   (160 Views)
In my script I open two file handles, one is a pipe to sendmail to send email, and the other is a file handle to a local file on the system. How can I print to both of these at the same timeCODE$sendmail = "/usr/sbin/sendmail -t";open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";open(FILE, "
Displaying multiple images from array   (140 Views)
i have 4 pics ( jpeg) in an array, but i'm having trouble displaying them all. It never displays all pics, tends to display them in random order, and some pics are repeated 2 or 3 times.Here's the html and the perl code:CODEhtml:i gave all file uploads the same name bcos its easier for me to put and arrange in an arrayPerl:CODE#!/usr/bin/perl use warnings; use CGI; use CGI::Carp qw/fatalsToBrowser/; my $query = new CGI; $upload_dir = 'C:/mystuff_htm/uploads'; my @fh = $query->upload('photo'); my $filename = $query->param("photo"); print "Content-type: text/html\n\n";foreach my $fhan(@fh){ open (UPLOADFILE, ">$upload_dir/$filename") or error($!); binmode UPLOADFILE; while ( ) { print UPLOADFILE; }} close UPLOADFILE;foreach $fhan(@fh){print "\n"; }
Matching multiple subexpressions in a regular expression   (133 Views)
On Mar 11, 6:13 pm, "John W. Krahn" wrote: .... > > since the one > > big regular expression can be compiled into a single large finite- > > state-machine that is more efficient than running 100 little FSM. > > That question is answered in perlfaq6: > > perldoc -q "How do I efficiently match many regular expressions at once" Hi John, If I structure my program as in the example, using many small regex instead of one big regex, Perl 5.8.6 runs out of memory and dies: vm_allocate failed, Out of memory! I have 400'000 regex of exactly 27 characters each, and the input string is one line 100 kB long. The machine has 2 GB of memory and free disk space, which should be enough, so I presume the code is somehow leeking memory. It's only a dozen or so lines long, so I've posted my code below. Can you see an obvious leak
syntax for or {multiple; statements;}?   (155 Views)
sorry for this lame question but I can't search it becuase I don't know how to explain it in searchable terms, what I did search turned up nothing useful. How can you execute multiple statements in Perl when perl ...
Copy multiples files to a single file in seperate pages..   (249 Views)
I'm a beginner with Perl and requires help.. Trying to understand if we have a mechanism to copy multiple files ( txt files ) to a single file (say abc.txt) with each file residing in single page. Each input ...
copying arrays   (140 Views)
In the following code the array @drop is modified as well as @drop2. How can I achieve modifying @drop2 without affecting @drop > @drop = ( > { 'hello' => 'world', 'hi' => 'there' }, > { 'hello' => 'dude', ...
Re: How to transparently download multiple files?   (135 Views)
On Apr 7, 9:35 pm, Ed Jay wrote: Normally I don't see stuff posted by trolls. This time someone failed to ignore a troll and so the trolls writings became visible in Ed's posting. People unfamiliar with Kiralynne Schilitubi ...
Telnet to multiple systems, continue on failure   (129 Views)
I'm trying to telnet to multiple system IP address that I'm loading from a file. However, if one of the telnet connections fails, the scripts stops. I want it to continue trying to telnet to the rest of the devices ...
Printing main window with multiple canvases...   (152 Views)
Does anybody know a simple way (an available Perl/Tk module perhaps ) of printing the contents of a mainwindow with multiple canvases I have saved the contents as a bitmap file, but if one wants to print them ...
match pattern of multiple lines   (112 Views)
I need to match the following pattern with a file, begin ...... end I check the web, it says I should use pattern modifier s & m, so I ...
Tk & Multi-port monitor cards (or multiple cards)   (121 Views)
How does one control the multiple displays of a multi-port monitor card with Tk...
Calling multiple perl subroutines from XS procedure   (130 Views)
XS manual pages, "Advanced perl programming" etc all mention the more-or-less such sequence to be used while calling perl subroutine from C code: { dSP; ENTER; SAVETMPS; PUSHMARK(sp); /* ... populating params with XPUSHs */ PUTBACK; int n = perl_call_method(...); ...
Complex multiple condition sort routine   (127 Views)
I'm trying to sort data in a particular way:- Primarily by the users choice.- Secondarily by "coordinates" (keys 'X' or 'Y' or 'Z').However, when the user first visits the webpage, because they haven't yet made a choice on how to sort the data, it should be sorted by default by the secondary method only.I am struggling to achieve the above task because the first condition of the sort routine would be "dynamic" (0 arguements (no user input), 1 arguement (user input), or possibly 3 arguements (default x, y, z)), if you understand what I mean.Here is some example data:CODEmy $data = [ { 'X' => "1", 'Y' => "1", 'Z' => "12", 'Username' => "Chris", 'ID' => "1672" }, { 'X' => "1", 'Y' => "1", 'Z' => "14", 'Username' => "Peter", 'ID' => "849" }, { 'X' => "1", 'Y' => "2", 'Z' => "2", 'Username' => "Laura", 'ID' => "801" }, { 'X' => "4", 'Y' => "6", 'Z' => "8", 'Username' => "Emily", 'ID' => "4690" }, { 'X' => "2", 'Y' => "9", 'Z' => "12", 'Username' => "Daniel", 'ID' => "7012" }, { 'X' => "1", 'Y' => "1", 'Z' => "4", 'Username' => "Chris", 'ID' => "1674" }];And here is my initial attempt at sorting it, pretending there is user input:CODEmy %sortroutines = ( 'X' => sub { $_[0] $_[1] }, 'Y' => sub { $_[0] $_[1] }, 'Z' => sub { $_[0] $_[1] }, 'Username' => sub { $_[0] cmp $_[1] }, 'ID' => sub { $_[0] $_[1] });my $sortby = 'Username';foreach my $row (sort { ( $sortroutines{$sortby}->($a->{$sortby}, $b->{$sortby}) ) || ( $sortroutines{'X'}->($a->{'X'}, $b->{'X'}) || $sortroutines{'Y'}->($a->{'Y'}, $b->{'Y'}) || $sortroutines{'Z'}->($a->{'Z'}, $b->{'Z'}) ) } @$data) { foreach my $cell (sort keys %$row) { print "$$row{$cell}"; } print "";}And my most recent attempt at achieving my overall task (messy):CODEmy %sortroutines = ();%sortroutines = ( 'Initial' => sub { $sortroutines{'X'}->($_[0], $_[1], 'X') || $sortroutines{'Y'}->($_[0], $_[1], 'Y') || $sortroutines{'Z'}->($_[0], $_[1], 'Z') }, 'X' => sub { $_[0]->{$_[2]} $_[1]->{$_[2]} }, 'Y' => sub { $_[0]->{$_[2]} $_[1]->{$_[2]} }, 'Z' => sub { $_[0]->{$_[2]} $_[1]->{$_[2]} }, 'Username' => sub { $_[0]->{$_[2]} cmp $_[1]->{$_[2]} }, 'ID' => sub { $_[0]->{$_[2]} $_[1]->{$_[2]} });my $sortby = param('sortby') || 'Initial';foreach my $row (sort { ( $sortroutines{$sortby}->($a, $b, $sortby) ) || ( $sortroutines{'X'}->($a, $b, $sortby) || $sortroutines{'Y'}->($a, $b, $sortby) || $sortroutines{'Z'}->($a, $b, $sortby) ) } @$data) { foreach my $cell (sort keys %$row) { print "$$row{$cell}"; } print "";}My 2nd attempt doesn't work correctly. My question is, how can I ignore the first condition of the sort routine if it isn't needed If I haven't made myself clear enough, please ask for further details.Thank you very much in advance for helping.Chris
Data Parsing of multiple lines into fields   (225 Views)
I have been able to parse the data from many blocks and lines into single fields, but am running into a brain freeze for further correlation. Data looks as follows and I need to make it look like FINAL data. Any pointers and my brain will thank you.DATASETsig1 a b c d esig1 f g h i jsig2 a b c d esig2 f g h i jFINAL DATAsig1 a f b g c h d i e jsig2 a f b g c h d i e j
Format fields in multiple files to Comma separated format.   (171 Views)
In need script for taking field's from multiple files in one directory files have the same "fields".example file:---------------------##### TEST NAME : xxxxxxxx##### TEST OWNER : XXXxxxxxx##### XXX DIGIT IDENTIFIER : AAA, AAA, AAA---------------------Need format , separated starting with the FILENAME in the first field:Need format to look like this------------------------FILENAME, TEST NAME, xxxxxxxx, xxxxxxxx, AAA, AAA, AAAFILENAME, TEST NAME, xxxxxxxx, xxxxxxxx, AAA, AAA, AAAFILENAME, TEST NAME, xxxxxxxx, xxxxxxxx, AAA, AAA, AAAFILENAME, TEST NAME, xxxxxxxx, xxxxxxxx, AAA, AAA, AAA------------------------Hoping someone can help here Given two equally predictive theories, choose the simpler.
How copying a file in a remote server to your own site   (160 Views)
Using perl how do you write a script to copy a remote file into your own site. In my situation want to copy a rss feed from http://remoteserver/news.xml for example. Marcos...
perl parse across multiple line in txt file   (242 Views)
i have a file with the following sample text 1 create table xyz 2 no before journal, 3 no after journal 4 ( 5 col1 integer, 6 col2 integer, 7 ... 8 coln varchar(10) 9 ) 10; i want to ...
Re: output from multiple files   (185 Views)
On comp.unix.shell, in , "John W. Krahn" wrote: > > > suraj_c@hotmail.com wrote: >> There are three files called first , second and third . Each is having >> three columns >> >> $cat first >> a b c >> ...