Re: Running older cgi scripts on nginx

2013-11-07 Thread Jim Gibson
On Nov 7, 2013, at 3:22 PM, Angela Barone wrote: Hello, I've set up a new cloud account to get familiar with nginx and I'd like to know if it's possible to run an older cgi perl script, and if so, how would I go about doing that? I think I read somewhere that it could be done

Re: [OT] SurfShopPRO Perl shopping cart system is now open source

2013-11-18 Thread Jim Gibson
On Nov 18, 2013, at 2:02 PM, SSC_perl wrote: Hi John, Thanks for getting back to me with your findings. I really appreciate it. I've gone through everything, made the changes that I could, and I have some questions to some of your remarks. You should be responding to the list,

Re: [OT] SurfShopPRO Perl shopping cart system is now open source

2013-11-19 Thread Jim Gibson
On Nov 18, 2013, at 2:02 PM, SSC_perl p...@surfshopcart.com wrote: Surf.pm:65: $cookie =~ Encode($cookie); Surf.pm:66: $value =~ Encode($value); Did you really mean to use the return value from Encode() as a regular expression? Unfortunately, I can't

Re: Regrex Question

2013-11-25 Thread Jim Gibson
On Nov 25, 2013, at 10:55 AM, Mike Blezien wrote: Hello, Regular expression have never been my strong suite so hoping to get a litte help with a line in file I need to extract a portion of it. The text I need to extract from this line is November 21, 2013 from this line in the file,

Re: remotely operate web page/website

2013-11-25 Thread Jim Gibson
On Nov 25, 2013, at 12:08 PM, Rajeev Prasad wrote: i need to go to a website and input some data in a specific input field, and run the query which opens a new page, i need to download and save it as an html page on my unix box. there are several blockages i am not able to figure out.

Re: Regex not working correctly

2013-12-11 Thread Jim Gibson
On Dec 11, 2013, at 7:34 AM, punit jain contactpunitj...@gmail.com wrote: Hi, I have a requirement where I need to capture phone number from different strings. The strings could be :- 1. COMP TEL NO 919369721113 for computer science 2. For Best Discount reach 092108493, from

Re: baby perl to get the right date

2014-01-30 Thread Jim Gibson
On Jan 27, 2014, at 11:32 PM, Luca Ferrari fluca1...@infinito.it wrote: Hi all, often I find myself writing something like the following to get the human date: my ($day, $month, $year) = (localtime())[3..5]; $month++, $year += 1900; print \nToday is $month / $day / $year \n; I was

Re: regex headache

2014-02-03 Thread Jim Gibson
On Feb 3, 2014, at 12:30 PM, Paul Fontenot wrote: Hi, I am attempting to write a regex but it is giving me a headache. I have two log entries 1. Feb 3 12:54:28 cdrtva01a1005 [12: 54:27,532] ERROR [org.apache.commons.logging.impl.Log4JLogger] 2. Feb 3 12:54:28 cdrtva01a1005 [12:

Re: OO perl programming

2014-02-13 Thread Jim Gibson
On Feb 13, 2014, at 12:27 PM, Uri Guttman wrote: On 02/13/2014 12:39 PM, Janek Schleicher wrote: Am 05.02.2014 23:30, schrieb kavita kulkarni: Can somebody suggest me good book to learn/practice object oriented Perl programming. The usual answer is to study computer science. OO

Re: regex to get version from file name

2014-02-23 Thread Jim Gibson
On Feb 21, 2014, at 6:21 AM, Wernher Eksteen crypt...@gmail.com wrote: Hi all, From the below file names I only need the version number 1.2.4 without explicitly specifying it. check_mk-1.2.4.tar.gz check_mk-agent-1.2.4-1.noarch.rpm check_mk-agent-logwatch-1.2.4-1.noarch.rpm

Re: regex to get version from file name

2014-02-23 Thread Jim Gibson
On Feb 23, 2014, at 5:10 AM, Wernher Eksteen crypt...@gmail.com wrote: Hi, Thanks, but how do I assign the value found by the regex to a variable so that the 1.2.4 from 6 file names in the array @fileList are print only once, and if there are other versions found say 1.2.5 and 1.2.6 to

Re: Calculate MD5 checksum of a remote and local file using FTP

2014-02-24 Thread Jim Gibson
On Feb 23, 2014, at 7:09 PM, Shaji Kalidasan shajiin...@yahoo.com wrote: Dear Perlers, I made some improvements in my code (now I am checking the file size of remote file) but still can't figure out how to calculate the MD5 hash of a remote file. You cannot calculate the MD5 digest of a

Re: check list if values meet criteria

2014-02-25 Thread Jim Gibson
On Feb 25, 2014, at 2:30 PM, Bill McCormick wrote: What would be the perl'ish way using map or some other sugar to check if a list of values meet some criteria? Instead of doing something like my @issues = qq(123,456,a45); my $max = 999; for (@issues) { die if $_ 0 or $_ $max; }

Re: file edit

2014-02-26 Thread Jim Gibson
On Feb 26, 2014, at 7:59 AM, jet speed speedj...@googlemail.com wrote: Chaps, Any quick one liner code in perl were i can get rid off the before and after wwn each line for file as below file --- device name lz_09_red_e10 vsan 200 * fcid 0xef0013 [pwwn

Re: match not matching

2014-03-01 Thread Jim Gibson
On Feb 28, 2014, at 9:13 PM, Bill McCormick wpmccorm...@gmail.com wrote: Can somebody help me understand this? Given this loop, and the logged output following ... my $found; for( @$products ) {; $found = $$_ =~ m|$project|; $dump = Data::Dumper-Dump([$_, $project, $$_, $found]);

Re: Reading a config file and exporting it updated with the new/changes values in the same format.

2014-03-03 Thread Jim Gibson
On Mar 3, 2014, at 8:47 AM, Wernher Eksteen wrote: Hi Shlomi, Thank you for the pointers. I do want to learn Python as well when I get a chance. This framework I'm writing now will automate things to a great extend eventually freeing up loads of my daily operations time so I can focus

Re: Delete first line when blank

2014-03-07 Thread Jim Gibson
On Mar 7, 2014, at 1:58 PM, s...@missionstclare.com wrote: I have some text files from which I would like to remove the first line, but only if it's blank. Any hints? I tried a few things, but the results haven't quite been satisfactory. You should be able to do that in just a few lines

Re: regexp puzzle

2014-03-07 Thread Jim Gibson
On Mar 7, 2014, at 10:05 PM, Bill McCormick wpmccorm...@gmail.com wrote: I have the following string I want to extract from: my $str = foo (3 bar): baz; and I want to to extract to end up with $p1 = foo; $p2 = 3; $p3 = baz; the complication is that the \s(\d\s.+) is optional, so

Re: RegExp

2014-03-08 Thread Jim Gibson
On Mar 8, 2014, at 4:50 AM, rakesh sharma rakeshsharm...@hotmail.com wrote: Hi all, how do you get all words starting with letter 'r' in a string. Try my @rwords = $string =~ /\br\w*?\b/g; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail:

Internet Search

2014-03-14 Thread Jim Gibson
On Mar 14, 2014, at 5:28 AM, Anant kumar anant.singh1...@gmail.com wrote: Hi everyone, I am trying to write a script to search on the internet for different keywords (like Organism name, metabolic reactions and Genes involved). Can anyone suggest me how to proceed.

Re: arbitrary sort

2014-03-25 Thread Jim Gibson
On Mar 25, 2014, at 6:55 AM, shawn wilson ag4ve...@gmail.com wrote: i want to sort an array for certain key words first and then alphabetically. my @foo = qw/foo bar baz first second third/; foreach my $i (sort {$a cmp $b} @foo) { print $i\n; } How do I make 'first', 'second', and

Re: arbitrary sort

2014-03-25 Thread Jim Gibson
On Mar 25, 2014, at 7:56 AM, shawn wilson ag4ve...@gmail.com wrote: Thanks (y'all). Though, I like this one best I think. BTW, Jim's isn't exactly correct: my @keys = qw( foo bar second baz first third ); my %primary = ( second = 1, first = 1, third = 1); And then the output becomes:

Re: use sys::virt module to manage VM in kvm

2014-03-26 Thread Jim Gibson
On Mar 26, 2014, at 6:30 PM, Benjamin Fernandis benjo11...@gmail.com wrote: Hi, I am new with perl and we have virtual machines in our infra. i want to use perl sys::virt module to manage them, means to shutdown / start vm by script and for that i wrote below small code.

Re: find specific line from file

2014-05-20 Thread Jim Gibson
On May 20, 2014, at 4:19 PM, Benjamin Fernandis wrote: Hi, I want to fetch rawuuid from below file for each partition name. I tried to use while loop and all but no luck. example : partition name : ada0p2 rawuuid: 5899824d-e019-11e3-9cbc-08002731cc9a file : Geom

Re: CPAN unavailable

2014-05-20 Thread Jim Gibson
On May 20, 2014, at 6:41 PM, Yonghua Peng sys...@mail2000.us wrote: I probably meant search.cpan.org doesn't work. Try picking a different mirror. These are the ones I am using: http://httpupdate35.cpanel.net/CPAN/ http://mirrors.gossamer-threads.com/CPAN/ http://cpan.cs.utah.edu/ -- To

Re: find specific line from file

2014-05-20 Thread Jim Gibson
Benjamin: Please post messages to the list, not individual members. On May 20, 2014, at 6:51 PM, Benjamin Fernandis benjo11...@gmail.com wrote: Hey Jim, I tried to use while loop to read file line by line, but facing problem to get exact phrase or a way to start reading from predefined

Re: How to parse C#, javascript, lisp source code for quoted literal strings

2014-05-22 Thread Jim Gibson
On May 22, 2014, at 2:04 AM, siegfr...@heintze.com siegfr...@heintze.com wrote: I need to extract some information from source code. How can I write a perl regular expression that will match a literal string in languages like C#, javascript, java and lisp? Here is my naive approach:

Re: Append new line at end of non-quoted text

2014-05-23 Thread Jim Gibson
On May 23, 2014, at 2:45 PM, Sherman Willden wrote: Disclaimer: I am 67 and not in school. I am doing this for my own satisfaction. How do I get a new line at the end of a non-quoted text. I am doing the following: Use Math::Trig; print pi * 2; print \n; How do I get the new line

Re: Append new line at end of non-quoted text

2014-05-23 Thread Jim Gibson
Please post messages to the list, not to me personally. That way, you will get better answers sooner. On May 23, 2014, at 3:13 PM, Sherman Willden wrote: Thank you, Jim; How do I get rid of the warning message without getting rid of the -w switch? Use the 'use warnings;' pragma in your

Re: How to implement locks/gates/semaphores to alleviate race conditions?

2014-05-24 Thread Jim Gibson
On May 24, 2014, at 9:40 AM, siegfr...@heintze.com wrote: I have multiple processes running cygwin/bash that are accessing the same files in a certain directory. I want to create a lock or semaphore or gate to serialize access to this directory so that no two (or more processes) can

Re: Brackets in scalar and array

2014-05-29 Thread Jim Gibson
On May 29, 2014, at 1:20 PM, James Kerwin wrote: Hello all, long time lurker, first time requester... I have a Perl exam tomorrow and came across a question that I just cannot find an answer to (past paper, this isn't cheating or homework etc.). Explain the difference between:

Re: Brackets in scalar and array

2014-05-29 Thread Jim Gibson
On May 29, 2014, at 3:34 PM, Sherman Willden wrote: Maybe I'm missing the point but isn't the following code the problem's answer? Please let me know if I am off base. Just a bit off (see below). #!/usr/bin/perl my @test = a b c; That is a scalar on the right-hand side. You end up with

Re: how to create a text progress status line that updates on the same line in Perl?

2014-06-10 Thread Jim Gibson
On Jun 10, 2014, at 2:59 PM, Kenneth Wolcott wrote: Hi All; how to create a text progress status line that updates on the same line in Perl? I know that this questions is probably not well-posed, but I hope you get what I'm after. I'd like to do what application installers do,

Re: bash to perl for cgi

2014-06-17 Thread Jim Gibson
On Jun 17, 2014, at 1:10 AM, Philippe Rousselot rousse...@rousselot.org wrote: Hi, I know nothing about perl and I have a problem with a cgi script for a website called geneweb (genealogy stuff). I moved from one web site to another and now the site does not work and give me a 500

Re: Stopping undefined warnings

2014-06-17 Thread Jim Gibson
On Jun 17, 2014, at 1:02 PM, SSC_perl wrote: What's the best way to stop undefined warnings for code like this: $data-{'image'} = CopyTempFile('image') if ($main::global-{'admin'} $main::global-{'form'}-{'image_upload'} ne ''); CGI::Carp gives the following: [Tue Jun 17

Re: Need to Grep only fail count from the Pattern.

2014-06-25 Thread Jim Gibson
On Jun 25, 2014, at 12:11 AM, Uday Vernekar vernekaru...@gmail.com wrote: Dear Ron, You are better off addressing your questions to the entire mailing list, rather than asking information from one person. Ron is not obligated to help you and may not be available, but others may be willing to

Re: Need to Grep only fail count from the Pattern.

2014-06-26 Thread Jim Gibson
On Jun 26, 2014, at 2:05 AM, Uday Vernekar wrote: Please suggest if any Corrections Needed. There are several improvements you could make. [code] #!/usr/bin/perl use 5.10.0; use strict; use warnings; #Pattern

Re: Need to Grep only fail count from the Pattern.

2014-06-30 Thread Jim Gibson
On Jun 30, 2014, at 2:44 AM, Uday Vernekar vernekaru...@gmail.com wrote: please Explain next if $line =~ /^-/; “Skip this input line if it starts with a dash ‘-‘ character.” my @f = split('\s*\|\s*',$line); Break the input line into files separated by the vertical pipe character ‘|’

Re: one line script for word count

2014-06-30 Thread Jim Gibson
On Jun 30, 2014, at 11:57 AM, Sunita Pradhan wrote: Hi I want to count number of occurrences of one word in a line within one single line of perl script . My code : $c++ if ($line =~ /\s+$w\s+/g); print count $c\n; Try this: $c = () = $line =~ /\b$w\b/g; -- To unsubscribe,

Re: one line script for word count

2014-06-30 Thread Jim Gibson
On Jun 30, 2014, at 12:17 PM, Sunita Pradhan wrote: Thanks Jim. It is working but why a array is required here? Please respond to the list and not to me personally. That way, everybody will see your question, and somebody else can answer. Try this: $c = () = $line =~ /\b$w\b/g;

Re: Need to Grep only fail count from the Pattern.

2014-07-01 Thread Jim Gibson
, 2014 at 9:06 PM, Jim Gibson jimsgib...@gmail.com wrote: On Jun 30, 2014, at 2:44 AM, Uday Vernekar vernekaru...@gmail.com wrote: please Explain next if $line =~ /^-/; “Skip this input line if it starts with a dash ‘-‘ character.” my @f = split('\s*\|\s*',$line); Break

Re: List::MoreUtils with array of arrays not working

2014-07-09 Thread Jim Gibson
On Jul 9, 2014, at 1:20 PM, Natxo Asenjo wrote: hi, i have an array of arrays which contains equal elements. I would like to isolate the unique values. Do you mean that the subarrays contain equal NUMBERS of elements? I have tried using the uniq method of List::MoreUtils but it

Re: List::MoreUtils with array of arrays not working

2014-07-09 Thread Jim Gibson
On Jul 9, 2014, at 2:58 PM, Natxo Asenjo wrote: On Wed, Jul 9, 2014 at 10:35 PM, Jim Gibson jimsgib...@gmail.com wrote: On Jul 9, 2014, at 1:20 PM, Natxo Asenjo wrote: hi, i have an array of arrays which contains equal elements. I would like to isolate the unique values

Re: List::MoreUtils with array of arrays not working

2014-07-10 Thread Jim Gibson
On Jul 10, 2014, at 11:50 AM, Natxo Asenjo wrote: On Thu, Jul 10, 2014 at 1:00 AM, Jim Gibson jimsgib...@gmail.com wrote: On Jul 9, 2014, at 2:58 PM, Natxo Asenjo wrote: On Wed, Jul 9, 2014 at 10:35 PM, Jim Gibson jimsgib...@gmail.com wrote: On Jul 9, 2014, at 1:20 PM, Natxo Asenjo wrote

Re: Date::Parse and strange dates

2014-07-25 Thread Jim Gibson
On Jul 25, 2014, at 9:54 AM, Chris Knipe wrote: Hi All, I have the odd (very rare) case where I am given a date in an incorrect format. I already use Date::Parse to convert the dates to a unix timestamp, and it’s working incredibly well. However, on the rare case that I get

Re: Suddenly this script is not working!

2014-07-29 Thread Jim Gibson
On Jul 28, 2014, at 3:59 PM, ESChamp esch...@gmail.com wrote: Suddenly, without warning or error messages, the script below is producing null for values of $hfile and $bfile! What are $hfile and $bfile? You don’t show them in your script. You show two arrays: @hfile and @bfile, but those are

Re: Suddenly this script is not working!

2014-07-29 Thread Jim Gibson
On Jul 29, 2014, at 5:12 PM, ESChamp esch...@gmail.com wrote: ESChamp wrote on 7/28/2014 6:59 PM: Suddenly, without warning or error messages, the script below is producing null for values of $hfile and $bfile! The script begins: Let me backtrack and provide some background

Re: Suddenly this script is not working!

2014-07-30 Thread Jim Gibson
On Jul 29, 2014, at 11:00 PM, ESChamp wrote: Jim Gibson wrote on 7/29/2014 10:08 PM: This is all speculation because you have not provided us with your exact program and data files. I was warned not to post a 3000 line data file and a 150 line program, but if you'd like me to send

Re: Why Does the Following Not Work?

2014-07-30 Thread Jim Gibson
On Jul 30, 2014, at 1:23 PM, Martin G. McCormick wrote: I thought that one could test for an empty or undefined array against the @arrayname but it looks like doing that always succeeds if it is set with my or our @arrayname. You can test for an empty or an undefined array. Any array in

Re: Suddenly.... Part 2

2014-07-31 Thread Jim Gibson
On Jul 31, 2014, at 12:02 PM, ESChamp wrote: John W. Krahn wrote on 7/31/2014 3:11 AM: Peter Holsberg wrote: I think I've isolated the section that is not doing what I want. open (FHIN, $recapfile) or die $!; That would be better as: open my $FHIN, '', $recapfile or die Cannot open

Re: What's wrong with this program?

2014-08-06 Thread Jim Gibson
On Aug 6, 2014, at 10:55 AM, ESChamp wrote: The program begins #!/usr/bin/perl You really should add these two lines: use strict; use warnings; here and correct the mistakes they reveal. use Tie::File; use File::Copy 'copy'; use File::Spec; my $copy=00-copy.htm; my

Re: Embed perl interpreter and call C function from perl?

2014-08-19 Thread Jim Gibson
On Aug 19, 2014, at 9:12 AM, Manuel Reimer wrote: Hello, there are many very good examples on how to execute perl code from C. For example the following tutorial is very helpful: http://perldoc.perl.org/perlembed.html But it only shows calling from C to perl. What I want to do is

Re: returning arrays (was: Re: return the list content)

2014-09-08 Thread Jim Gibson
On Sep 8, 2014, at 3:13 PM, lee wrote: Shawn H Corey shawnhco...@gmail.com writes: On Mon, 18 Aug 2014 16:17:53 +0800 Ken Peng o...@dnsbed.com wrote: sub myfunc { my @x=(1,2,3); return \@x; } # or, sub myfunc { my @x=(1,2,3); return [@x]; } # or sub myfunc {

Re: returning arrays

2014-09-09 Thread Jim Gibson
On Sep 9, 2014, at 2:09 PM, lee wrote: Jim Gibson jimsgib...@gmail.com writes: On Sep 8, 2014, at 3:13 PM, lee wrote: Shawn H Corey shawnhco...@gmail.com writes: On Mon, 18 Aug 2014 16:17:53 +0800 # or sub myfunc { return [ 1, 2, 3 ]; } Is there a difference to sub myfunc

Re: returning arrays

2014-09-09 Thread Jim Gibson
On Sep 9, 2014, at 2:57 PM, Shawn H Corey wrote: On Tue, 09 Sep 2014 23:09:52 +0200 lee l...@yun.yagibdah.de wrote: my $i = 1; my $f = 2.5; my $s = 'string'; my $list = (1, 2, 3); No, the count of items in the list gets stored in $list: $list == 3 Unless the thing on the

Re: share a variable between files

2014-10-08 Thread Jim Gibson
The ‘our’ statement associates a simple name with a package global variable in the current package. Therefore, if you want to make $var in file b.pl mean the package global variable $var in package a ($a:var), just put ‘our $var;’ after the ‘package a;’ statement in file b.pl (see below). On

Re: use perl format data

2015-02-05 Thread Jim Gibson
On Feb 5, 2015, at 6:53 PM, Wang, Zeng-Sheng (TS-GSD-China-ZZ) zengsheng.w...@hp.com wrote: Dear Uri, First thanks for your kindly help and a read-friendly instruction, I will not use $a and $b for variables. According to your explanation, I finish the code as below:

Re: Using regular expressions to populate a variable?

2015-01-18 Thread Jim Gibson
On Jan 18, 2015, at 9:03 AM, Mike ekimduna...@gmail.com wrote: I was able to find match extraction in the perldoc. Here is a snippet of what I have. my $insult = ( $mech-text =~ m/Insulter\ (.*)\ Taken/ ); print $insult\n; But $insult is being populated with: 1 It should be

Re: Eclipse - How do I get back to the first splash screen

2015-03-13 Thread Jim Gibson
On Mar 13, 2015, at 2:07 PM, Sherman Willden sherman.will...@gmail.com wrote: I downloaded Eclipse and I was looking at the screens and in general just messing with Eclipse. Now I can't find the first splash screen with the tutorials, samples, and such. Also is there a help button on

Re: How to sort a file based on numerical values exists in each line

2015-03-24 Thread Jim Gibson
On Mar 24, 2015, at 3:42 AM, Anirban Adhikary anirban.adhik...@gmail.com wrote: Hi List I have a file like this. RXMOI:MO=RXOTRX-473-0,SC=0,DCP1=178,SIG=SCCONC,DCP2=179186,TEI=0; RXMOI:MO=RXOTRX-473-5,SC=0,DCP1=223,SIG=SCCONC,DCP2=224231,TEI=5;

Re: How to sort a file based on numerical values exists in each line

2015-03-24 Thread Jim Gibson
On Mar 24, 2015, at 7:27 AM, Anirban Adhikary anirban.adhik...@gmail.com wrote: Hi Jim In your code there is some hard coded value [ /RXMOI:MO=RXOTRX But I can't put any hard coded value since I use this code as a function and pass the filename as an argument. As you can see in my

Re: Spliting and creating small files from a main files based on line number

2015-03-25 Thread Jim Gibson
On Mar 25, 2015, at 10:07 AM, Anirban Adhikary anirban.adhik...@gmail.com wrote: Hi List I have a configuration file and I would like to split the main file into multiple small files and push the small temp. files into an array. My config file looks like this

Re: Good books to study perl interpreter

2015-03-30 Thread Jim Gibson
The best book on Perl (in my opinion) is “Programming Perl, 4th ed.”, Christiansen, foy, Wall, Orwant. See “perldoc perlbook” for other recommendations, as well as http://books.perl.org On Mar 30, 2015, at 9:42 AM, rakesh sharma rakeshsharm...@hotmail.com wrote: Hi all Please suggest

Re: OTRS module

2015-03-26 Thread Jim Gibson
On Mar 26, 2015, at 3:54 PM, Benjamin Fernandis benjo11...@gmail.com wrote: Hi, We are using otrs help desk system which is in fully perl. We require to append automatic comment when our specific customer raise ticket to us. We have iteam no for each customer.So when customer send mail

Re: Changing the structure of a hash

2015-06-17 Thread Jim Gibson
It seems that you are working with a two-dimensional array of numbers, so it is not clear why you are using a hash to store this data instead of an array of arrays. What you seem to be asking for is to generate the transpose of the two-dimensional array. So the simplest approach would be to

Re: Fire and forget subs

2015-07-06 Thread Jim Gibson
On Jul 6, 2015, at 9:43 AM, Unknown User knowsuperunkn...@gmail.com wrote: What is a good way to fire and forget a sub from a module in perl, in a non blocking mode, preferably without forking or using threads. I may have to run the sub a few times to determine the approx delay for it to

Re: reading from socket

2015-08-11 Thread Jim Gibson
On Aug 11, 2015, at 3:16 PM, Chris Knipe sav...@savage.za.org wrote: Lastly, you're reading from a socket so there's no guarantee that the buffer string is going to necessarily end at the termination boundary. Perhaps the protocol guarantees that, but the socket surely doesn't. You may

Re: Yenc encoder performance

2015-07-31 Thread Jim Gibson
On Jul 31, 2015, at 4:39 AM, David Emanuel da Costa Santiago deman...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hello. Thanks for your reply. I remember that i did some performance tests and $string = $string .something had better performance

Re: Perl multi threading

2015-08-01 Thread Jim Gibson
On Aug 1, 2015, at 1:49 AM, bikram behera jobforbik...@gmail.com wrote: Hi Team, can you tell me about perl multi threading, uses of multi threading with examples. See ‘perldoc perlipc’ for all kinds of information about multi-threading with lots of example code. -- To unsubscribe,

Re: convert linear array to nested structure

2015-07-21 Thread Jim Gibson
On Jul 21, 2015, at 12:40 PM, Simon Reinhardt si...@keinstein.org wrote: Hi Team, is there a ready solution to convert an linear array of hashrefs like this [ {level = 0, value = string1}, {level = 1, value = string2}, {level = 2, value = string3}, {level = 2, value = string4} ]

Re: How to interpolate a hash in a string

2015-11-03 Thread Jim Gibson
> On Nov 3, 2015, at 2:03 PM, David Emanuel da Costa Santiago > wrote: > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > > Hello all. > > I'm trying to interpolate a hash value in a string but i got stuck. > I already tried with eval, without any success… Show

Re: Traversing directory recursively

2015-07-09 Thread Jim Gibson
On Jul 9, 2015, at 8:27 AM, Nagy Tamas (TVI-GmbH) tamas.n...@tvi-gmbh.de wrote: Hi, So I have a better version. But if it goes down in the recursion tree, at the end it goes into infinite loop, because there is no other dir inside the last dir in the tree. At this point it has to

Re: remove from mailing list

2015-11-26 Thread Jim Gibson
> On Nov 26, 2015, at 7:06 AM, Parysatis Sachs wrote: > > Hey, > > can you please remove me from the mailing list? > > Thanks! To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org -- To unsubscribe,

Re: having trouble understanding the built-in Perl sort with regards to mixed numbers and strings

2016-06-17 Thread Jim Gibson
If you want to sort your data numerically, then the data must look like a number. Your data is mixed numerical and alpha data, hence the error message. You first need to extract the numerical parts of your data records and compare just those parts. The first step would be to write a sort

Re: Counter Help

2016-02-09 Thread Jim Gibson
a hash with the strings as keys and the number of strings encountered in the array so far as the hash value. You can then add the number to each string as you iterate over the array and increment the hash value count. Jim Gibson j...@gibson.org -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Counter Help

2016-02-09 Thread Jim Gibson
> On Feb 9, 2016, at 6:46 AM, James Kerwin wrote: > > Thank you both very much for your help. I'll investigate this way when I get > home later (I'm a bit wary of hashes because they're weird). Here is a solution using a hash: #!/usr/bin/perl use strict; use warnings;

Re: Storing Output file.

2016-01-28 Thread Jim Gibson
close($out) or die(“Error writing to output file $newfile: $!”); # rename the old file my $savefile = $filename . ‘.sav’; rename $filename, $savefile; # rename the new file rename $newfile, $filename; Jim Gibson j...@gibson.org -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

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

Re: perl for machine learning

2017-02-07 Thread Jim Gibson
onks.org/?node_id=638391> <http://search.cpan.org/~kwilliams/Algorithm-SVMLight/lib/Algorithm/SVMLight.pm> <https://www.youtube.com/watch?v=Cdcx4lbUbes> Jim Gibson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: How to pass all `dig` arguments to Net::DNS?

2017-01-21 Thread Jim Gibson
through the documentation and figure that out. For example, you can print out individual sections like this: print "\n;; HEADER SECTION\n"; $reply->header->print(); but I don’t see anything that supports an optional TSIG file equivalent to the -k option (I don’t know what that is, so can’t help with that). Good luck! Jim Gibson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: newbie question for parsing incoming mails

2017-02-15 Thread Jim Gibson
On Feb 15, 2017, at 7:10 PM, Eko Budiharto wrote: > > Jim, > if I want to extract all incoming emails from my qmail emails, how can > specify the folder location and specify the file name since the file name > always different? > > Thx. Use File::Find or opendir and

Re: newbie question for parsing incoming mails

2017-02-15 Thread Jim Gibson
> On Feb 15, 2017, at 8:10 PM, Eko Budiharto wrote: > > dear Jim, > I tried to add lines to read file like this: > > use Email::MIME; > > my $file = '/var/qmail/mailnames/

Re: warnings in Math::Complex

2017-02-09 Thread Jim Gibson
> On Feb 9, 2017, at 7:39 AM, Simon Bauer wrote: > > Hi, > > when I turn on -W in one of my perl scripts then I get a lot of warnings > concerning Math::Complex > > Prototype mismatch: sub Math::Complex::abs (_) vs none at > /usr/share/perl/5.22/Math/Complex.pm line 667.

Re: newbie question for parsing incoming mails

2017-02-16 Thread Jim Gibson
> On Feb 15, 2017, at 9:56 PM, Eko Budiharto wrote: > > Jim, > I have one a couple more questions. > -. For the header, what if, I just need the subject, the from, and the > recipient, what is the command? I read the manual in the >

Re: newbie question for parsing incoming mails

2017-02-15 Thread Jim Gibson
he email file into the variable $text I do this: my $mime = Email::MIME->($text); my @parts = $mime->parts(); for my $npart ( 0..$#parts ) { my $part = $parts[$npart]; my $header = $part->header_obj(); my $htext = $header->as_string(); my $body = $part->body(); … } Jim Gi

Re: calculate within a loop

2016-09-10 Thread Jim Gibson
> On Sep 9, 2016, at 8:54 AM, Nathalie Conte wrote: > > Hello, > I have a question about making a calculation within a loop > > I have a hash of hashes > ## > #!/usr/bin/perl > use strict; > use warnings; > > use Data::Dumper qw(Dumper); > > my %grades; >

Re: calculate within a loop

2016-09-12 Thread Jim Gibson
> On Sep 12, 2016, at 6:24 AM, Nathalie Conte wrote: > > Dear all, > > Thanks a lot for the codes various people which all work perfectly!! I have > also discover some useful functions (eval and state) which can also be very > helpful for this kind of data. > > In the

Re: Perl file exists check

2016-11-10 Thread Jim Gibson
> On Nov 10, 2016, at 3:34 AM, jaceke wrote: > > I would like as argument of function use path with special characters then '' > are needed. > That's why function adding apostrophe but after adding apostrofe file cannot > be found. If the string value of the scalar variable

Re: Perl file exists check

2016-11-10 Thread Jim Gibson
On Nov 10, 2016, at 2:30 AM, jaceke wrote: > > Hi, > how can I check if file exist or not ? > > Here's a short test/example: > > if (-e '/etc/passwd') > { > printf "File exist !\n"; > } else { > printf "File not exist !\n"; > } > > That works great ! > > but next a short

Re: Perl file exists check

2016-11-10 Thread Jim Gibson
See inline comments below. On Nov 10, 2016, at 3:15 AM, jaceke wrote: > > This example will be better : > > #!/usr/bin/perl > use strict; > use File::Basename; > use utf8; > You should indent all blocks (subroutines, if statements, loops, etc.) to make it easier to read and

Re: Changing date format using carpout

2017-03-25 Thread Jim Gibson
> On Mar 25, 2017, at 8:51 AM, SSC_perl wrote: > > I’ll sometimes use the following code at the beginning of a script to > log errors while testing: > > BEGIN { > use CGI::Carp qw(carpout); > open(_STDERR,'>'); close STDERR; > open (my $log,

Re: Warnings when sorting by hashref

2017-04-11 Thread Jim Gibson
gt; Use of uninitialized value in uc at > > Any ideas how to get rid of the warning Make sure that all $options{$key}->{type} values are defined: foreach my $key ( keys %options ) { $options{$key}->{type} = ‘’ unless defined $options{$key}->{type}; } Substitute something else for ‘’ depe

Re: How to use Text::Wrap correctly

2017-08-13 Thread Jim Gibson
doc Text::Wrap how @text is supposed > to be populated. @text is a list of scalar strings passed to the wrap subroutine. You can pass a single string also. Try this loop instead: while (<>) { if (/$rgx/) { print "\n"; print wrap(",", $_); } } It is usually better t

Re: Filehandle within foreach loop

2017-07-12 Thread Jim Gibson
H, $file) or die "could not open file\n"; > > while( my $line = <$FH> ){ > #[process the lines & hash construction.] > } > close $FH; > } > > Regards, > Kamal. Jim Gibson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: File::Find report file count per directory

2017-06-28 Thread Jim Gibson
ate. If I had to do this, I would create a hash that had the directory name as a key and the number of files in that directory that have a numerical file name. I would use File::Find to traverse the directory tree, check the name of each non-directory file, and increment the count for the enclosing directory for each such file I found. A line something like this: $filecount{$File::Find::dir}++; would be central to my program. Jim Gibson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: File::Find .. still confused slightly

2017-07-05 Thread Jim Gibson
; $total_dir++; $total_files += $nfiles; } print "\n<$total_files> files in <$total_dir> directories\n”; Note that I recommend keeping the raw numerical data (file counts) and not saving the output lines. Generate the output lines when you print them. Jim Gibson

Re: keyboard input without pressing return?

2017-05-14 Thread Jim Gibson
> On May 5, 2017, at 6:06 PM, lee <l...@yagibdah.de> wrote: > > > Hi, > > how can a sleeping program react to a key that was pressed without > return being pressed? > See ‘perldoc -q "How can I read a single character from a file? From the keyboard?”

Re: prime factors

2017-05-02 Thread Jim Gibson
note that the smallest factor of any number cannot be larger than the square root of that number, so the function isprime need not consider potential factors larger than the square root of its argument. Jim Gibson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: How to use Text::Wrap correctly

2017-08-19 Thread Jim Gibson
> On Aug 18, 2017, at 6:05 AM, Harry Putnam <rea...@newsguy.com> wrote: > > jimsgib...@gmail.com (Jim Gibson) writes: >>> > > A second attempt trying to use your last example as inspiration > follows: > > ---8< snip -8< snip -

Re: Questions about CGI

2018-06-06 Thread Jim Gibson
tps://metacpan.org/pod/CGI> <https://metacpan.org/pod/Task::Kensho#Task::Kensho::WebDev:-Web-Development> > > > > -- > Ahmad Bilal > Jim Gibson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

<    2   3   4   5   6   7   8   >