Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-02-25 Thread khalil zakaria Zemmoura
Naming multiple variables with the same name like you did ($args, %args) is a bad idea. because when you want to access the value of the hash %args ($args{FN}) you are accessing in reality what was shifted in the scalar $args and not the hash %args because perl use simbolic reference. here is a li

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-02-25 Thread ZEMMOURA Khalil Zakaria
On Sun, Jan 15, 2017 at 12:45:41PM -0800, al...@myfastmail.com wrote: > Hi > > On Sun, Jan 15, 2017, at 12:23 PM, Илья Рассадин wrote: > > I think, you can use this aproach > > If I use either of those > > > sub modrec { > - my %args = %{ shift @_ }; > +

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread Chas. Owens
On Sun, Jan 15, 2017, 16:19 wrote: Hi, On Sun, Jan 15, 2017, at 01:01 PM, Shawn H Corey wrote: > > Is there a different, recommended way? > > Nothing's wrong. perlcritic does not this valid method, that's all. > > TIMTOWTDI (There Is More Than One Way To Do It.) Hm, ok. As long as it's not wro

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread Rob Dixon
Hi Alan You are unpacking `@_` in a way, but perlcritic doesn't recognise doing it this way. I think you'd be better off without dereferencing the hash, and using a slice to assign your local variables. I would write your subroutine like this sub modrec { my ($args) = @_;

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread alanj
Hi, On Sun, Jan 15, 2017, at 01:01 PM, Shawn H Corey wrote: > > Is there a different, recommended way? > > Nothing's wrong. perlcritic does not this valid method, that's all. > > TIMTOWTDI (There Is More Than One Way To Do It.) Hm, ok. As long as it's not wrong/broken in some weird way. I kep

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread Shawn H Corey
On Sun, 15 Jan 2017 12:09:53 -0800 al...@myfastmail.com wrote: > What's wrong with the way I'm unpacking the arguments passed to the > subroutine, > > my %args = %{ shift @_ }; > > Is there a different, recommended way? Nothing's wrong. perlcritic does not this valid method, that's all.

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread Илья Рассадин
Hi! You forgot arrow operator $args->{'FN'}, not $args{'FN'} 15.01.17 23:45, al...@myfastmail.com пишет: Hi On Sun, Jan 15, 2017, at 12:23 PM, Илья Рассадин wrote: I think, you can use this aproach If I use either of those sub modrec { - my %args = %{ shift

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread alanj
Hi On Sun, Jan 15, 2017, at 12:23 PM, Илья Рассадин wrote: > I think, you can use this aproach If I use either of those sub modrec { - my %args = %{ shift @_ }; + my ($args) = @_; 30 my $fn = $args{FN};

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread Илья Рассадин
Hi! I think, you can use this aproach sub modrec { my ($args) = @_; # or my $args = shift @_; use what you like more my $fn = $args->{'FN'}; } 15.01.17 23:09, al...@myfastmail.com пишет: Hi, I have a simple script with a subroutine that I pass scalar & array arguments

Re: Script runs slower with better hardware

2016-06-02 Thread David Santiago
Hi James. I'm going to take a look into the perf utility. The `openssl speed` command shows that the desktop cpu has a bigger throughput than the laptop, so the write_partial in the desktop shouldn't spend that much time (in comparison to laptop). The output of the openssl command is attached. R

Re: Script runs slower with better hardware

2016-06-02 Thread James Alton
The laptop has better specs in terms of number of threads and memory bandwidth. I'd also have a play around with the "perf" command if all other software versions are the same and you want to see if the lower level CPU usage is different. https://perf.wiki.kernel.org/index.php/Tutorial http://sand

Re: Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
Hello James, The CPUs are Laptop CPU: i7 Q 720 Desktop CPU: i5 6500T The rest of software i'm using: Perl version: 5.22 Net::SSLeay version: 1.72 Openssl version: 1.0.2.h OS: Archlinux up to date. The script is single threaded and i'm using a single IO::Select->select() to know when i shoul

Re: Script runs slower with better hardware

2016-06-01 Thread James Alton
Can you please give specs on both CPUs? (The exact manufacturer and model.) Is there a reason why you think one CPU is better than another? You can have a CPU that's old and fast at single threaded jobs (say an old overclocked dual core 4.0Ghz CPU) and a newer CPU that's slower at single threaded

Re: Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
Unfortunatelly i don't have a third box. :-( I'm going to follow your advice and send an email to p5p. Thank you! Best regards, David Santiago On Wed, 1 Jun 2016 16:17:47 -0400 Uri Guttman wrote: > On 06/01/2016 04:04 PM, David Emanuel da Costa Santiago wrote: > > Hi Kent, > > > > They are u

Re: Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
The openssl version is 1.0.2.h. Thanks for your help. I'm going to follow Uri's advice and send an email to p5p list. Thank you! Regards, David Santiago On Thu, 2 Jun 2016 08:18:23 +1200 Kent Fredric wrote: > On 2 June 2016 at 08:04, David Emanuel da Costa Santiago > wrote: > > They are us

Re: Script runs slower with better hardware

2016-06-01 Thread Kent Fredric
On 2 June 2016 at 08:04, David Emanuel da Costa Santiago wrote: > They are using the same verion of Net::SSLeay (version 1.72). All the > software have the same version. No, not Net::SSLeay ... OpenSSL, which it links against. And if you recently upgraded/downgraded OpenSSL to match versions, N

Re: Script runs slower with better hardware

2016-06-01 Thread Uri Guttman
On 06/01/2016 04:04 PM, David Emanuel da Costa Santiago wrote: Hi Kent, They are using the same verion of Net::SSLeay (version 1.72). All the software have the same version. This is not random. This happens 100% of the times. All the settings related to this script are the same. I don't think

Re: Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
Hi Kent, They are using the same verion of Net::SSLeay (version 1.72). All the software have the same version. This is not random. This happens 100% of the times. All the settings related to this script are the same. I don't think it's my network card, because i can reach the maximum speed u

Re: Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
Hi Shlomi, This snippet is from nytprof, and it's where it's spending most of the time: > Calls: 10631 > Exclusive Time: 28.2s > Inclusive Time: 28.2s > Subroutine: Net::SSLeay::write_partial (xsub) > > On my desktop: > Calls: 5057 > Exclusive Time: 45.0s > Inclusive Time: 45.0s > Subroutine: N

Re: Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
No. My laptop doesn't have TPM (at least there's no option in the BIOS to enable/disable and there's nothing in /sys/class/tpm/ ). My desktop have, but not enabled: desktop$ cat /sys/class/tpm/tpm0/device/enabled 0 desktop$ Do you think it's because of that? With other applications i can reach

Re: Script runs slower with better hardware

2016-06-01 Thread Kent Fredric
On 2 June 2016 at 06:25, David Emanuel da Costa Santiago wrote: > The question for one million dollar is "Why?". And how can i improve > the performance of my desktop to reach the same speed as my laptop > (considering that i have better hardware on my desktop)? If i recompile > perl instead of us

Re: Script runs slower with better hardware

2016-06-01 Thread Shlomi Fish
On Wed, 1 Jun 2016 20:25:39 +0200 David Emanuel da Costa Santiago wrote: > Hi! > > I have a script that writes to a socket, but i noticed that the same > script have diferent speeds on different machines. It's faster on my > 5 year laptop than on my desktop. > > I profiled the script on both ma

Re: Script runs slower with better hardware

2016-06-01 Thread Shlomi Fish
On Wed, 1 Jun 2016 20:25:39 +0200 David Emanuel da Costa Santiago wrote: > Hi! > > I have a script that writes to a socket, but i noticed that the same > script have diferent speeds on different machines. It's faster on my > 5 year laptop than on my desktop. > > I profiled the script on both ma

Re: Script to fork, send data to parent via a tcp conn

2016-05-16 Thread Jim Gibson
> On May 15, 2016, at 5:05 AM, Unknown User wrote: > > The port is not in use before i run the script. It is in use when i > run it. However the problem is that only one iteration runs. I > expected all to run. Your ‘listen’ statement is in a loop. Therefore, the second time through the loop,

Re: Script to fork, send data to parent via a tcp conn

2016-05-16 Thread Unknown User
The port is not in use before i run the script. It is in use when i run it. However the problem is that only one iteration runs. I expected all to run. On Sun, May 15, 2016 at 1:52 AM, Jon E Price wrote: > Perhaps port 8989 is in use? > > Have you tried >telnet 127.0 0.1 8989 > > Can you conn

Re: Script to fork, send data to parent via a tcp conn

2016-05-14 Thread lee
Unknown User writes: > I wrote this scrpt to fork off a few child processes, then the child > processes process some data, and send the data back to the parent > through a tcp socket. > This is not working as i expected it would. Why not? How can it be corrected? > > > #!/usr/bin/perl -w > use st

Re: Script to fork, send data to parent via a tcp conn

2016-05-14 Thread Uri Guttman
On 05/13/2016 11:30 AM, Unknown User wrote: I wrote this scrpt to fork off a few child processes, then the child processes process some data, and send the data back to the parent through a tcp socket. This is not working as i expected it would. Why not? How can it be corrected? there are many i

Re: Script to fork, send data to parent via a tcp conn

2016-05-14 Thread Jon E Price
Perhaps port 8989 is in use? Have you tried >telnet 127.0 0.1 8989 Can you connect? On May 14, 2016, at 3:56 PM, Unknown User wrote: >I wrote this scrpt to fork off a few child processes, then the child >processes process some data, and send the data back to the parent >through a tcp socke

Re: script to parse OCR output different between servers

2015-07-22 Thread Gary Stainburn
All I can say is,, I've not had a good day. This is the correct code for getting the most popular value. I'd forgot to update $count with $value foreach my $field (keys %found) { # foreach field my $value=''; my $count=0; foreach my $key (keys %{$found{$field}}) { # foreach field -> value

Re: script to parse OCR output different between servers

2015-07-22 Thread Gary Stainburn
Below is my revised code based on your comments. It is tidier but more importantly it works correctly. Ironically, it didn't actually work correctly before on my dev machine either,– it didn't find all matches. It looks like using my original code it was only using the first element in each

Re: script to parse OCR output different between servers

2015-07-22 Thread Shlomi Fish
Hi Gary, see below for my comments. On Wed, 22 Jul 2015 17:11:29 +0100 Gary Stainburn wrote: > On Wednesday 22 July 2015 16:10:18 Shlomi Fish wrote: > > Hi Gary, > > > > some comments about your code. > > > > On Wed, 22 Jul 2015 15:32:33 +0100 > > > > Gary Stainburn wrote: > > > I've written t

Re: script to parse OCR output different between servers

2015-07-22 Thread Gary Stainburn
On Wednesday 22 July 2015 16:10:18 Shlomi Fish wrote: > Hi Gary, > > some comments about your code. > > On Wed, 22 Jul 2015 15:32:33 +0100 > > Gary Stainburn wrote: > > I've written the code below to parse a number of text page files > > generated by Tesseract OCR software to look for a guess the

Re: script to parse OCR output different between servers

2015-07-22 Thread Shlomi Fish
Hi Gary, some comments about your code. On Wed, 22 Jul 2015 15:32:33 +0100 Gary Stainburn wrote: > I've written the code below to parse a number of text page files generated by > Tesseract OCR software to look for a guess the most likely values for VIN, > Reg number and stock number for a veh

Re: Script for auto conf

2014-12-30 Thread Ilan Shlossman
Hi Shlomi This comparing method work fine, you can use sysyem() instead of ` ` , but the output will be the same. By the way , I'm looking for a new position in scripting area . Thanks Ilan On Tue, Dec 30, 2014 at 1:57 PM, Shlomi Fish wrote: > Hi Ilan, > > On Tue, 30 Dec 2014 13:31:45 +0200 >

Re: Script for auto conf

2014-12-30 Thread Shlomi Fish
Hi Ilan, On Tue, 30 Dec 2014 13:31:45 +0200 Ilan Shlossman wrote: > comparring 2 files: > > `sort $filesToCompre[0] >/dev/null 2>&1`; > > `sort $filesToCompre[1] >/dev/null 2>&1`; > > > > `comm -23 $filesToCompre[0] $filesToCompre[1] > $Diff_File`; > > `comm -13 $filesToCompre[0] $fi

Re: Script for auto conf

2014-12-30 Thread Ilan Shlossman
comparring 2 files: `sort $filesToCompre[0] >/dev/null 2>&1`; `sort $filesToCompre[1] >/dev/null 2>&1`; `comm -23 $filesToCompre[0] $filesToCompre[1] > $Diff_File`; `comm -13 $filesToCompre[0] $filesToCompre[1*] * >>$Diff_File`; On Tue, Dec 30, 2014 at 1:22 PM, Alan Glait wrote:

Re: Script for auto conf

2014-12-30 Thread Alan Glait
Thanks to all !!! You are right Brandon .. Sorry about my post. I started searching how to compare 2 files like this: use strict; use warnings; my $f1 = 'E:\upload\new\2.txt'; my $f2 = 'E:\upload\new\a.txt'; my $outfile = 'E:\upload\new\1.txt'; my %results = (); open FILE1, "$f1" or die "Could not

Re: Script for auto conf

2014-12-30 Thread Andrew Solomon
Hi Alan This is the module I'd use for it: https://metacpan.org/pod/Config::Tiny The simplest approach would be to: * read the destination config file (some_file.conf) into $Config_current * read the config in-tray (param.txt) into $Config_new * add the in-tray parameters to $Config_current fo

Re: Script for auto conf

2014-12-29 Thread Brandon McCaig
On Tue, Dec 30, 2014 at 12:47:13AM -0300, Alan Glait wrote: > Hi ! Hello, > I have the Idea to make a perl script (better than in bash) to make some > configuration on linux. > I think to have some files like param.txt with some lines like: > param_one = ZZZ XX VV > param_two = Z > p

Re: Script for auto conf

2014-12-29 Thread Mike
I have a feeling this could easier be accomplished with bash. On 12/29/14 9:47 PM, Alan Glait wrote: Hi ! I have the Idea to make a perl script (better than in bash) to make some configuration on linux. I think to have some files like param.txt with some lines like: param_one = ZZZ XX VV

Re: script to match a valid email id

2014-07-11 Thread Gunnar Hjalmarsson
On 2014-07-10 20:30, Sunita Pradhan wrote: > I want to write a script which will verify a valid email address . > Could anybody give some ideas , how to write a pattern for this ? Almost 10 years ago I posted this: http://www.mail-archive.com/beginners%40perl.org/msg62681.html Probably that funct

Re: script to match a valid email id

2014-07-11 Thread David Precious
On Fri, 11 Jul 2014 10:20:10 +0300 Yosef Levy wrote: > 2014-07-10 21:30 GMT+03:00 Sunita Pradhan > : > > > I want to write a script which will verify a valid email address . > > Could anybody give some ideas , how to write a pattern for this ? > \b[\w\.-]+@[\w\.-]+\.\w{2,4}\b > This was taken fr

Re: script to match a valid email id

2014-07-11 Thread Yosef Levy
\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b This was taken from: http://www.regexr.com/ 2014-07-10 21:30 GMT+03:00 Sunita Pradhan : > I want to write a script which will verify a valid email address . > Could anybody give some ideas , how to write a pattern for this ? > > -Sunita >

Re: script to match a valid email id

2014-07-10 Thread David Precious
On Thu, 10 Jul 2014 11:54:07 -0700 Bob goolsby wrote: > Nota Bene: > xxx@zzz.www IS NOT the only valid format for an email > address In this case, you really need to rethink your objection > to using the proper CPAN module *This*. Use the well-trusted, battle-tested CPAN module. Whate

Re: script to match a valid email id

2014-07-10 Thread Mike
That's a lot of regex. On 7/10/14, 2:25 PM, Ron Bergin wrote: Sunita Pradhan wrote: I do not want to use Cpan modules . -Sunita What do you have against using a cpan module? If you don't want to use the module, then why not simply copy/use the regex that it uses to do the validation? $RFC8

RE: script to match a valid email id

2014-07-10 Thread Ron Bergin
Sunita Pradhan wrote: > I do not want to use Cpan modules . > > -Sunita > What do you have against using a cpan module? If you don't want to use the module, then why not simply copy/use the regex that it uses to do the validation? $RFC822PAT = <<'EOF'; [\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:

Re: script to match a valid email id

2014-07-10 Thread Розанда ЧУП
the "r...@i.frys.com" address may not be matched by my regexp, because here two dots after @. Here it is more universal: /\A.+?\@.+?\..+\Z/ 10.07.2014, 21:43, "Sunita Pradhan" : > I do not want to use Cpan modules . > > -Sunita > >> Date: Thu, 10 Jul 2014 11

Re: script to match a valid email id

2014-07-10 Thread Розанда ЧУП
use the regular expression for checking @ and dot and length of some address' parts:) for example, try this: #!/usr/bin/perl use warnings; use strict; use 5.014; print "enter the email address "; while (<>) { if(/\A.{4,15}\@.+?\..{2,3}\Z/) { print "it's correct\n"; }

Re: script to match a valid email id

2014-07-10 Thread Andy Bach
On Thu, Jul 10, 2014 at 1:42 PM, Sunita Pradhan < sunita.pradhan.2...@hotmail.com> wrote: > I do not want to use Cpan modules . > Depending upon how "correct" you want to be, it's not easy: http://stackoverflow.com/questions/210945/what-would-be-a-globally-accepted-regular-expression-to-match-e-

Re: script to match a valid email id

2014-07-10 Thread Bob goolsby
, you really need to rethink your objection to using the proper CPAN module. B On Thu, Jul 10, 2014 at 11:42 AM, Sunita Pradhan < sunita.pradhan.2...@hotmail.com> wrote: > I do not want to use Cpan modules . > > -Sunita > > > Date: Thu, 10 Jul 2014 11:33:24 -0700 &g

Re: script to match a valid email id

2014-07-10 Thread SSC_perl
On Jul 10, 2014, at 11:30 AM, Sunita Pradhan wrote: > I want to write a script which will verify a valid email address . > Could anybody give some ideas , how to write a pattern for this ? Sunita, I've used Email::Valid for this and it works nicely. And the code to use it is pretty easy

RE: script to match a valid email id

2014-07-10 Thread Sunita Pradhan
I do not want to use Cpan modules . -Sunita > Date: Thu, 10 Jul 2014 11:33:24 -0700 > Subject: Re: script to match a valid email id > From: r...@i.frys.com > To: sunita.pradhan.2...@hotmail.com > CC: beginners@perl.org > > Sunita Pradhan wrote: > > I want to write a

Re: script to match a valid email id

2014-07-10 Thread Ron Bergin
Sunita Pradhan wrote: > I want to write a script which will verify a valid email address . > Could anybody give some ideas , how to write a pattern for this ? > > -Sunita > Take a look at the Email::Valid module. http://search.cpan.org/~rjbs/Email-Valid-1.194/lib/Email/Valid.pm -- To unsubscrib

Re: script dies when Net::DNS resolve fails

2013-05-13 Thread Dr.Ruud
On 13/05/2013 18:08, David Precious wrote: The usual way to catch exceptions is with an eval block or Try::Tiny etc. Basic example: my $source_address = eval { $res->query(); }; if ($@) { # an error occurred - $@ will contain the message # do something appropriate here } Testi

Re: script dies when Net::DNS resolve fails

2013-05-13 Thread David Precious
On Mon, 13 May 2013 08:53:13 -0700 Noah wrote: > Hi list, > > > When Net::DNS resolved name is not found my script dies. How can I > allow for my script to continue on even if there is a failed DNS > query? The usual way to catch exceptions is with an eval block or Try::Tiny etc. Basic exam

Re: script dies when Net::DNS resolve fails

2013-05-13 Thread Lawrence Statton
On 05/13/2013 10:53 AM, Noah wrote: When Net::DNS resolved name is not found my script dies. How can I allow for my script to continue on even if there is a failed DNS query? Impossible to say -- you do not show enough to know what is happening AFTER the block shown. -- To unsubscribe, e-ma

Re: Script for create a file name with Invalid characters in windows

2012-11-02 Thread Shlomi Fish
Hi Bhanu, On Fri, 2 Nov 2012 18:49:58 +0530 bhanu chaitanya abbaraju wrote: > Hi All, > > Can any one help me, how can we create a file name with invalid characters > ('?','/') in windows. Generally, Windows OS can not allow to create a file > name with invalid characters like '?,/' . But, I he

Re: Script to test connecting to Oracle DBs

2012-08-01 Thread Leo Susanto
use strict; use DBI; use DBD::Oracle qw(:ora_types); my $user = ''; my $passwd = ''; my $tnsName = ''; $ENV{'ORACLE_HOME'} = 'C:\oracle\product\10.2.0\client_1'; my $dbh = DBI->connect("dbi:Oracle:$tnsName", $user, $passwd); my $SQL = qq{ SELECT XXX}; my $sth0 = $dbh->prepare($SQL); print "SQL

RE: Script to test connecting to Oracle DBs

2012-08-01 Thread Martin Gainty
#!/bin/sh C:/grep/grep.exe -S "(SERVICE_NAME =" tnsnames.ora > service.ora rm -r new.ora echo "#!/bin/sh" > tns_ping.sh C:/cygwin/bin/sed.exe 's/(SERVICE_NAME \=/tnsping.exe /' service.ora>>tns_ping.sh vi tns_ping.sh If you find There is a way to pipe the 2 commands let me know but for now this

Re: Script to test connecting to Oracle DBs

2012-07-27 Thread Rob Dixon
On 28/07/2012 02:45, newbie01 perl wrote: > Hi all, > > I am looking for a Perl script or something similar that I can use to test > connection from a client PC to several databases on a server. > > Does anyone know of any such script lying around somewhere :(- > > Currently, am testing connecti

Re: script produced no output

2012-03-17 Thread Shawn H Corey
On 12-03-17 04:20 AM, Shlomi Fish wrote: You should use better quoting here. Doing \" excessively is an anti-pattern. Maybe use a here-document. It would be better if the OP used a module to generate the HTML. CGI.pm is included with all Perl installations but is the most rudimentary. More ad

Re: script produced no output

2012-03-17 Thread Shlomi Fish
Hi Eko, On Sat, 17 Mar 2012 11:19:27 +0700 Eko Budiharto wrote: > dear list, > I have a perl script that I would like to run from any browsers. I tried > it on firefox and internet explorer, but both gave me, the same error > message, "Content-type: text/html > > 'C:\HRMS\cgi-bin\cetakKuponMa

Re: script to create to create tar and place files in the appropriate folder

2011-05-31 Thread Agnello George
>push @files, @dirfiles; >} > >return { >src_uri => $src_uri, >dest_uri => $dest_uri, >files => \@files >}; > } > > sub prompt_to_continue > { >my ($instructions) = @_; >print Dumper $instructions; >print "Continue? (yes/no) "; >exit(1)

Re: script to create to create tar and place files in the appropriate folder

2011-05-31 Thread Uri Guttman
> "JWK" == John W Krahn writes: JWK> Uri Guttman wrote: >>> "JWK" == John W Krahn writes: >> >> that is called 4 arg substr and it is way underused in perl. this >> benchmark shows the significant speedup of about 2x: >> >> >> use Benchmark qw( cmpthese ) ; >> >>

Re: script to create to create tar and place files in the appropriate folder

2011-05-31 Thread John W. Krahn
Uri Guttman wrote: "JWK" == John W Krahn writes: JWK> Or as: JWK> $_ = "$directory/$_" for @dirfiles[ 1 .. $#dirfiles ]; just to show another way that is usually faster for prepending a string: substr( $_, 0, 0, "$directory/" ) for @dirfiles[ 1 .. $#dirfiles ]

Re: script to create to create tar and place files in the appropriate folder

2011-05-31 Thread Uri Guttman
> "BM" == Brandon McCaig writes: BM> On Tue, May 31, 2011 at 4:34 PM, Uri Guttman wrote: >> just to show another way that is usually faster for prepending a string: >> >>        substr( $_, 0, 0, "$directory/" ) for @dirfiles[ 1 .. $#dirfiles ]; >> >> that is called 4 arg subst

Re: script to create to create tar and place files in the appropriate folder

2011-05-31 Thread Brandon McCaig
On Tue, May 31, 2011 at 4:34 PM, Uri Guttman wrote: > just to show another way that is usually faster for prepending a string: > >        substr( $_, 0, 0, "$directory/" ) for @dirfiles[ 1 .. $#dirfiles ]; > > that is called 4 arg substr and it is way underused in perl. this > benchmark shows the

Re: script to create to create tar and place files in the appropriate folder

2011-05-31 Thread Brandon McCaig
On Tue, May 31, 2011 at 4:23 PM, John W. Krahn wrote: > Just a couple of comments on some of your code.  :) > *snip* >>     @lines = @lines[$start_line..$#lines]; > > You are copying almost all of @lines to @lines when you should be using > perl's built-in functions to just remove elements from @l

Re: script to create to create tar and place files in the appropriate folder

2011-05-31 Thread Uri Guttman
> "JWK" == John W Krahn writes: JWK> Or as: JWK>$_ = "$directory/$_" for @dirfiles[ 1 .. $#dirfiles ]; just to show another way that is usually faster for prepending a string: substr( $_, 0, 0, "$directory/" ) for @dirfiles[ 1 .. $#dirfiles ]; that is called 4

Re: script to create to create tar and place files in the appropriate folder

2011-05-31 Thread John W. Krahn
Brandon McCaig wrote: Hello, Just a couple of comments on some of your code. :) my $start_line = 2; unless($lines[1] =~ /^\s*$/) { warn "The second line isn't empty" ; $start_line--; } @lines = @lines[$start_line..$#lines]; You are copying a

Re: script to create to create tar and place files in the appropriate folder

2011-05-31 Thread Brandon McCaig
On Tue, May 31, 2011 at 2:15 AM, Agnello George wrote: > i am given ever day a list of files  which i wget  within a parent folder . > > my  team gives me    a structure where theses files are located *snip* > using the above data given to me  i check whether the files exist  and if > they do i do

Re: script to create to create tar and place files in the appropriate folder

2011-05-31 Thread Agnello George
> ls >> >> index.php 123.php dual.templ dual_2.templ go.php data.txt >> >> i need to create a tar of this in the same given format >> >> index.php >> dualfilder/dual.templ dual_2.templ >> go/go.php >> go/numbers/123.php >> data/data.php >> >> >> i cant seem to come up with a a logic on how to g

Re: script to create to create tar and place files in the appropriate folder

2011-05-31 Thread Rob Dixon
On 31/05/2011 07:15, Agnello George wrote: HI i am given ever day a list of files which i wget within a parent folder . my team gives mea structure where theses files are located cat /home/upload_files1.txt download the files form wget http://localserver/website1 and

Re: script to create to create tar and place files in the appropriate folder

2011-05-31 Thread shawn wilson
On May 31, 2011 2:16 AM, "Agnello George" wrote: > > HI > > > i am given ever day a list of files which i wget within a parent folder . > > my team gives mea structure where theses files are located > > > cat /home/upload_files1.txt > download the files form wget http://loc

Re: script takes long time to run when comparing digits within strings using foreach

2011-05-28 Thread John W. Krahn
eventual wrote: Hi, Hello, I have an array , @datas, and each element within @datas is a string that's made up of 6 digits with spaces in between like this “1 2 3 4 5 6”, so the array look like this @datas = ('1 2 3 4 5 6', '1 2 9 10 11 12', '1 2 3 4 5 8', '1 2 3 4 5 9' , '6 7 8 9 10 11'); No

Re: script takes long time to run when comparing digits within strings using foreach

2011-05-28 Thread Dr.Ruud
On 2011-05-27 10:18, eventual wrote: I have an array , @datas, and each element within @datas is a string that's made up of 6 digits with spaces in between like this “1 2 3 4 5 6”, so the array look like this @datas = ('1 2 3 4 5 6', '1 2 9 10 11 12', '1 2 3 4 5 8', '1 2 3 4 5 9' , '6 7 8 9 1

Re: script takes long time to run when comparing digits within strings using foreach

2011-05-27 Thread Shlomi Fish
Hi eventual, On Friday 27 May 2011 11:18:01 eventual wrote: > Hi, > I have an array , @datas, and each element within @datas is a string that's > made up of 6 digits with spaces in between like this “1 2 3 4 5 6”, so the > array look like this @datas = ('1 2 3 4 5 6', '1 2 9 10 11 12', '1 2 3 4 5

Re: Script to prepend text to beginning of file

2011-01-21 Thread Brian Fraser
> > use strict; > use warnings; > use Tie::File; > > my @array; > tie @array, 'Tie::File', FILENAME or die "Couldn't open file: $!" > > unshift @array, <<'END_PREPEND'; > ENTHDR|1|3.0 > STAGEHDR|Barcoded > END_PREPEND > Haven't tested it, but it should work. http://perldoc.perl.org/Tie/File.html

Re: Script to prepend text to beginning of file

2011-01-21 Thread Shlomi Fish
Hi Ary, On Friday 21 Jan 2011 17:39:48 Ary Kleinerman wrote: > Shlomi, > > On Fri, Jan 21, 2011 at 12:13 PM, Shlomi Fish wrote: > > Hi Ary, > > > > On Friday 21 Jan 2011 16:01:36 Ary Kleinerman wrote: > > > A simple way: > > > > > > #!/usr/bin/perl -w > > > open FILE, ">>file.txt"; > > > print

Re: Script to prepend text to beginning of file

2011-01-21 Thread Ary Kleinerman
Shlomi, On Fri, Jan 21, 2011 at 12:13 PM, Shlomi Fish wrote: > Hi Ary, > > On Friday 21 Jan 2011 16:01:36 Ary Kleinerman wrote: > > A simple way: > > > > #!/usr/bin/perl -w > > open FILE, ">>file.txt"; > > print FILE "line1\n"; > > print FILE "line2\n"; > > print FILE "ENTHDR|1|3.0\n"; > > print

Re: Script to prepend text to beginning of file

2011-01-21 Thread Shlomi Fish
Hi Ary, On Friday 21 Jan 2011 16:01:36 Ary Kleinerman wrote: > A simple way: > > #!/usr/bin/perl -w > open FILE, ">>file.txt"; > print FILE "line1\n"; > print FILE "line2\n"; > print FILE "ENTHDR|1|3.0\n"; > print FILE "STAGEHDR|Barcoded\n"; > close FILE; > This script will *append* 4 lines to

Re: Script to prepend text to beginning of file

2011-01-21 Thread Shlomi Fish
Hi Steve, On Thursday 20 Jan 2011 20:57:50 steve1040 wrote: > I need to add 2 lines to a file and add the following text. > > ENTHDR|1|3.0 > STAGEHDR|Barcoded > > I don't have any idea how to do this in Perl > In UNIX and UNIX-like systems (including Windows), it is useful to think of a file

Re: Script to prepend text to beginning of file

2011-01-21 Thread Ary Kleinerman
A simple way: #!/usr/bin/perl -w open FILE, ">>file.txt"; print FILE "line1\n"; print FILE "line2\n"; print FILE "ENTHDR|1|3.0\n"; print FILE "STAGEHDR|Barcoded\n"; close FILE; On Thu, Jan 20, 2011 at 3:57 PM, steve1040 wrote: > I need to add 2 lines to a file and add the following text. > > E

Re: script for shutdown remote machine

2010-09-05 Thread Steve Bertrand
On 2010.09.04 01:40, Jyoti wrote: > Dear All, > Give me name of CPAN modules to write down perl script for shudown remote > machines. This is not a beginner-type question. Any `beginner' would have at *least* said some form of 'thanks in advance' (even though that is frowned upon where I come fro

Re: script for shutdown remote machine

2010-09-03 Thread Kenneth Wolcott
On Fri, Sep 3, 2010 at 23:18, Jyoti wrote: > yes > > On Sat, Sep 4, 2010 at 11:47 AM, Kenneth Wolcott > wrote: >> >> On Fri, Sep 3, 2010 at 23:11, Kenneth Wolcott >> wrote: >> > On Fri, Sep 3, 2010 at 22:40, Jyoti wrote: >> >> Dear All, >> >> Give me name of CPAN modules to write down perl scri

Re: script for shutdown remote machine

2010-09-03 Thread Kenneth Wolcott
On Fri, Sep 3, 2010 at 23:07, Jyoti wrote: > > Dear All, > Please Give me name of CPAN modules to write down perl script for shudown > remote >  machines. > > > On Sat, Sep 4, 2010 at 11:36 AM, Kenneth Wolcott > wrote: >> >> On Fri, Sep 3, 2010 at 22:40, Jyoti wrote: >> > Dear All, >> > Give me

Re: script for shutdown remote machine

2010-09-03 Thread Kenneth Wolcott
On Fri, Sep 3, 2010 at 23:11, Kenneth Wolcott wrote: > On Fri, Sep 3, 2010 at 22:40, Jyoti wrote: >> Dear All, >> Give me name of CPAN modules to write down perl script for shudown remote >> machines. >> > > You could buy one or more of Dave Roth's books. > > He wrote lots of nice Windows Perl mo

Re: script to connect windows box from linux

2010-09-03 Thread Anand Parthiban
Hi Irfan, Please Check out Winexe In Linux, It would be very usefule to you Because It will Also do the task which you require It will conect to your windows box, Run the Windows Commands, Brings the Output to Linux Box You can Download the software from the Following Link: http://downloads.sou

Re: script to connect windows box from linux

2010-09-02 Thread C.DeRykus
On Sep 2, 10:11 am, lel...@claimspages.com ("Lonnie Ellis") wrote: > You can also turn on the telnet service within Windows rather than using > SSH.  If you want to use SSH, openSSH is a good alternative for Windows, > but you'll have to install Cygwin on the Windows box.  Google it, you > should f

RE: script to connect windows box from linux

2010-09-02 Thread Lonnie Ellis
er 02, 2010 12:48 PM > To: Irfan Sayed; beginners@perl.org > Subject: Re: script to connect windows box from linux > > On 9/2/10 Thu Sep 2, 2010 8:49 AM, "Irfan Sayed" > scribbled: > > > Can somebody please give me any pointer > > i am stuck > >

Re: script to connect windows box from linux

2010-09-02 Thread Jim Gibson
On 9/2/10 Thu Sep 2, 2010 8:49 AM, "Irfan Sayed" scribbled: > Can somebody please give me any pointer > i am stuck > I need to write one Perl script which does the following tasks > > 1: from linux box , connect to windows box > 2: run some commands > 3: copy the output of those commands to

Re: script to connect windows box from linux

2010-09-02 Thread Irfan Sayed
Can somebody please give me any pointer i am stuck Regards Irfan From: Irfan Sayed To: beginners@perl.org Sent: Thu, September 2, 2010 7:09:55 PM Subject: script to connect windows box from linux Hi All, I need to write one Perl script which does the follow

Re: script output => color highlight to stdout

2010-05-28 Thread Harry Putnam
trapd...@trapd00r.se writes: > And if you want to work with 256 colors (note that not all terminals support > this, and it should be avoided if it's not for your own use) you can do > something like this: > > > my @colors; > for(my $i=0;$i<256;$i++) { > push(@colors, "\033[38;5;$i".'m'); > } > p

Re: script output => color highlight to stdout

2010-05-28 Thread Eitan Adler
On Thu, May 27, 2010 at 6:22 PM, Harry Putnam wrote: > I wondered if anyone could steer me to some information about making > perl script output appear in color highlight on stdout. > > Something like what modern grep does on linux, where the searched term > appears in some color (red) in the outp

Re: script output => color highlight to stdout

2010-05-28 Thread trapd00r
On 27/05/10 22:16 -0500, Bryan Harris wrote: my $e = "\033[0m"; my %cc = ( white => "\033[1;37m", ltgray => "\033[0;37m", gray => "\033[1;30m", black => "\033[0;30m", red => "\033[0;31m", ltred => "\033[1;31m", green => "\033[0;32m", l

Re: script output => color highlight to stdout

2010-05-28 Thread Bryan Harris
Try this > I wondered if anyone could steer me to some information about making > perl script output appear in color highlight on stdout. > > Something like what modern grep does on linux, where the searched term > appears in some color (red) in the output to tty. > > Try this code snippet

Re: script output => color highlight to stdout

2010-05-27 Thread Jim Gibson
At 10:22 AM -0500 5/27/10, Harry Putnam wrote: I wondered if anyone could steer me to some information about making perl script output appear in color highlight on stdout. Something like what modern grep does on linux, where the searched term appears in some color (red) in the output to tty. p

Re: Script runs fine when passed args directly, not as stdin

2010-03-02 Thread Shlomi Fish
On Tuesday 02 Mar 2010 22:07:28 Joseph L. Casale wrote: > >I'm commenting on your code below with some general remarks. Not sure if > >this will fix your problem. > > Shlomi, > I greatly appreciate your time going through this, I have undergone > rewriting it from scratch with your suggestions. It

RE: Script runs fine when passed args directly, not as stdin

2010-03-02 Thread Joseph L. Casale
>I'm commenting on your code below with some general remarks. Not sure if this >will fix your problem. Shlomi, I greatly appreciate your time going through this, I have undergone rewriting it from scratch with your suggestions. It was a script I copied from an existing one which was a bad idea:)

Re: Script runs fine when passed args directly, not as stdin

2010-03-02 Thread Shlomi Fish
Hi jlc! On Tuesday 02 Mar 2010 06:38:09 Joseph L. Casale wrote: > Hi, > I should state first I don't have the luxury of using Perl often > and am super rusty:) > > I have a script that sends snmp commands to a switch either by passing > args directly or as stdin. It works when passing them direct

  1   2   3   4   >