Re: Subroutine return value

2025-05-14 Thread Jim Gibson via beginners
I’d like to understand what’s > actually happening. And I suspect I’m offending some veterans by not making > Perl-ish use of #_. Sorry about that. > 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: Regex To get the Job Number and Corresponding state

2025-02-25 Thread Jim Gibson
If you are reading a file with normal line endings (e.g., “\n”), then you want to parse each line as “key: value” using a regular expression, save the job id, current status and current phase values. When you have all three, you can check the status and phase values for the values you are lookin

Re: Linux Directory Copy Modules that Won't

2025-02-01 Thread Jim Gibson via beginners
pies a directory. Something like: use strict; use File::Copy::Recursive qw(dircopy); my $orig = “…”; my $new = “…”; dircopy( $orig, $new ); and see what happens. An easier way to generate a string with embedded quote signs is to use the q (single quot

Re: https://metacpan.org/pod/OpenOffice::OODoc

2024-01-28 Thread Jim Gibson via beginners
looking for something similar to Excel::Writer::XLSX, mainly to > automatically export database tables to spreadsheets from perl > programs in ods format rather than in xlsx format. > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-

Re: help with making an sftp connection

2023-04-16 Thread Jim Gibson via beginners
nformative, so I'm not sure how to best > do this. > > It looks like Net::SFTP::Foreign might best fit my needs, but I'm open to > suggestions. > > > Advice or a code snippet on how to make the connection should be enough, and > much appreciated!! > >

Re: A Regular Expression Problem in Perl 5.28

2023-03-29 Thread Jim Gibson via beginners
quot;n" times, but not more than "m" times. 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: Can use perl for download photos from facebook?

2022-03-20 Thread Jim Gibson
> Can you upload that to a gist and share it here? >> >> On Sat, Mar 19, 2022 at 8:48 PM William Torrez Corea >> wrote: >> I have a short code: >> >> #!/usr/bin/perl; >> @ARGV = ("Facebook.html"); >> while(<>){ >> while(/

Re: Can use perl for download photos from facebook?

2022-03-20 Thread Jim Gibson
t/v/t39.30808-1/274490608_3202483196693292_7724900589789523726_n.jpg ... Jim Gibson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Can use perl for download photos from facebook?

2022-03-19 Thread Jim Gibson
Check out the LWP library of modules on CPAN: <https://metacpan.org/pod/LWP> > On Mar 19, 2022, at 6:07 AM, William Torrez Corea > wrote: > > I have an idea from the program but I don't know where to start. > Jim Gibson -- To unsubscribe, e-mail: beginner

Re: use string in "use"

2020-12-14 Thread Jim Gibson
t; use RW::Docs$DEBUG; > > I've found that you can use "require" and pass a path. I understand that > require is run time, while use is compile time. Are there any down-sides to > using require? > > -- > To unsubscribe, e-mail: beginners-unsubscr.

Re: regex help - only one value returned

2020-12-02 Thread Jim Gibson
s > multiple matches. The amendment to the REGEX worked perfectly. It is always best to save the results of a match with capturing in another variable. The capturing variables $1, $2, etc. are not reassigned if a match fails, so if you use them after a failed match, they will be the valu

Re: Varnish module configuration

2020-11-15 Thread Jim Gibson
> On Nov 15, 2020, at 2:42 AM, Marco Shaw wrote: > > https://metacpan.org/source/RCL/Varnish-CLI-0.03/lib%2FVarnish%2FCLI.pm > > I don't know if I'm doing something wrong. I'm trying to use this CLI > against an upgraded Varnish server and it seems the new version is built with > a secret b

Re: perl script with wrong

2019-10-13 Thread Jim Gibson
$id} = $line; > } > } else { > $hash{$id} = $line; > } > } > > my @val = values %hash; > print OUT "@val\n"; > > close OUT; > close IN; > } > > > > > > -- > Hunan Normal University, Changsha, China:Dong Liu > > 格言:积土而为山,积水而为海; > 知识在于积累,成功在于勤奋。 > > > 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: Hi Folks : I'm trying to create a regular expression for finding a # wishing a dataset for only a number that is a multiple of 5

2019-09-08 Thread Jim Gibson
> On Sep 8, 2019, at 6:36 PM, Olivier wrote: > > Jim Gibson writes: > >> On Sep 8, 2019, at 3:39 PM, Mike wrote: >>> >>> >>> It's probably best if you write a short script >>> that reads a __DATA__ section of data. >&

Re: Hi Folks : I'm trying to create a regular expression for finding a # wishing a dataset for only a number that is a multiple of 5

2019-09-08 Thread Jim Gibson
ut I don't know what you expect it to do. > I expect it to return a positive value if $t contains a number anywhere within it and put that number in the $1 capture variable. > > Mike > > > On 9/8/2019 4:34 PM, Jim Gibson wrote: >> On Sep 8, 2019, at 1:30 PM, Gauta

Re: Hi Folks : I'm trying to create a regular expression for finding a # wishing a dataset for only a number that is a multiple of 5

2019-09-08 Thread Jim Gibson
On Sep 8, 2019, at 1:30 PM, Gautam Desai wrote: > > Do you guys have any pointers ? $t =~ m{ ( # capture matched number in $1 \d* # match zero or more decimal digits [05] # followed by a '0' or '5' )

Re: reading text data to variable

2018-12-28 Thread Jim Gibson
org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ Jim Gibson jimsgib...@gmail.com -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Syntax "||" before sub

2018-11-24 Thread Jim Gibson
> On Nov 24, 2018, at 12:49 PM, David Precious wrote: > > I went to perldoc perlop expecting to be able to find a > section to point the OP at as a "here's the documentation for it", and > couldn't find anything particularly useful. I was able to find this in “perldoc perlop”: Assignment O

Re: Code Assistance Pls

2018-11-21 Thread Jim Gibson
> On Nov 21, 2018, at 3:08 AM, Amanda Paziuk wrote: > > Folks, > > I'm hoping someone can assist as I'm having difficulty with parsing a section > of the following configuration: > > This is the code I have: > > open (IN, $file); # only sharing this because you need to know where > @l

Re: use Time::Piece

2018-10-31 Thread Jim Gibson
On Oct 31, 2018, at 1:29 PM, Martin McCormick wrote: > > > I'd like to say that it's working but not yet. There seems to be > nothing wrong with the string now. > > my $t1 = Time::Piece->strptime("$obtime[1], %d %b %Y %H:%M:%S %z”); strptime is a method with two arguments: string to be parse

Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread Jim Gibson
: > > Hi Jim/All, > > I have already done that now the issue is how do I print the > lines from file2 only between start $t2 and <$t3 then process these lines is > next step ? > Please share the code if you have . > > Thanks, >

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Jim Gibson
from file2 > > Please advice , > > thanks, For each line is the file, use a regular expression to look for lines starting with ‘LOG file opened at’ and extract the time that follows in that line. Then, use Time::Piece to create an object of that class using the date/time extracted. Then, you can compare the time in that line to your start and stop times in $t2 and $t3 (or is it $t1 and $t3?). 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 compare timestamp in two different files

2018-10-22 Thread Jim Gibson
On Oct 22, 2018, at 9:12 PM, Asad wrote: > > file1 : > Patching tool version 12.1.0.2.0 Production on Fri Feb 23 01:10:28 2018 > > Bootstrapping registry and package to current versions...done > statement ERR-2001: table is corrupt check for cause > > could not determine the current status. >

Re: sftp code to use

2018-10-21 Thread Jim Gibson
helpful > > > sftp u...@xyx.com 1212 > pasword:xxx > cd /patch1 > get patch1.zip > unzip patch1.zip > sqlplus / as sysdba ===> connect to oracle database > sql>startup > > > Thanks, > > -- > Asad Hasan > +91 9582111698 Jim Gibson -- To unsub

Re: Regex for date

2018-08-25 Thread Jim Gibson
regex to match the date : Sat Aug 25 08:41:03 2018 and > covert into a format : '%m/%d/%Y %H:%M:%S' > > Thanks, > > -- > Asad Hasan > +91 9582111698 Jim Gibson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: help with a stat script

2018-07-12 Thread Jim Gibson
> On Jul 12, 2018, at 5:50 AM, Lauren C. wrote: > > thanks for the kind helps. > do you know what the expression in { } stands for? > > ^(\S+) - - \[(\S+).*\] \"GET (.*?/)\s+ Here is a breakdown: ^ Start looking for matches at beginning of string (\S+) Match a consecutive seq

Re: Questions about CGI

2018-06-06 Thread Jim Gibson
s: <https://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/

Re: How to use Text::Wrap correctly

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

Re: How to use Text::Wrap correctly

2017-08-13 Thread Jim Gibson
t 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 to use explicit variab

Re: Filehandle within foreach loop

2017-07-12 Thread Jim Gibson
ile\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 .. still confused slightly

2017-07-05 Thread Jim Gibson
$shortdir; $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. J

Re: File::Find report file count per directory

2017-06-28 Thread Jim Gibson
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: keyboard input without pressing return?

2017-05-14 Thread Jim Gibson
> On May 5, 2017, at 6:06 PM, lee 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?” Jim Gibson jgib...@snowla

Re: prime factors

2017-05-02 Thread Jim Gibson
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: Warnings when sorting by hashref

2017-04-11 Thread Jim Gibson
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 ‘’ depending upon where you

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,'>&STDERR'); close STDERR; > open (my $log, '>>', 'logs/error.log

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 > https://metacpan.org/pod/Email::MIM

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 r

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/ name>/support/Maildir/cur/1487041394.M984019P23084V0803I00E03878.ABC

Re: newbie question for parsing incoming mails

2017-02-15 Thread Jim Gibson
e 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 Gibson -- To u

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. > Prototype mism

Re: perl for machine learning

2017-02-07 Thread Jim Gibson
e_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
ram does, but you will have to dig 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: 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 that is passed to

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 follow the struct

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 test/example: >

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 light of this, my datas

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; > $grades{"Foo "}{1} =

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 routin

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: 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; my @array = qw{

Re: Counter Help

2016-02-09 Thread Jim Gibson
ings 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: Storing Output file.

2016-01-28 Thread Jim Gibson
ebug/Error/g; > print "After substituting : ", $line , "\n”; print $out $line; > > } > > close(FILE); close($in); close($out) or die(“Error writing to output file $newfile: $!”); # rename the old file my $savefile = $filename . ‘.sav’; rename

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, e-mail: beginners-unsubscr...@pe

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 us what you tried. >

Re: reading from socket

2015-08-11 Thread Jim Gibson
> On Aug 11, 2015, at 3:16 PM, Chris Knipe 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 need to look for t

Re: Perl multi threading

2015-08-01 Thread Jim Gibson
> On Aug 1, 2015, at 1:49 AM, bikram behera 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, e-mail: beginners-u

Re: Yenc encoder performance

2015-07-31 Thread Jim Gibson
> On Jul 31, 2015, at 4:39 AM, David Emanuel da Costa Santiago > 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 performanc

Re: convert linear array to nested structure

2015-07-21 Thread Jim Gibson
> On Jul 21, 2015, at 12:40 PM, Simon Reinhardt 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 => "strin

Re: Traversing directory recursively

2015-07-09 Thread Jim Gibson
> On Jul 9, 2015, at 8:27 AM, Nagy Tamas (TVI-GmbH) > 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 step back. But

Re: Fire and forget subs

2015-07-06 Thread Jim Gibson
> On Jul 6, 2015, at 9:43 AM, Unknown User 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 > run, so i suppose i

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 con

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 > On Mar 30, 2015, at 9:42 AM, rakesh sharma wrote: > > Hi all > > Please suggest nice books to know

Re: OTRS module

2015-03-26 Thread Jim Gibson
> On Mar 26, 2015, at 3:54 PM, Benjamin Fernandis 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 and in body h

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 > 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 > > GRC01;8;8;1;1;323U6_SIU-8;2048;2048;20;0

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 > 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 yo

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 > wrote: > > Hi List > I have a file like this. > RXMOI:MO=RXOTRX-473-0,SC=0,DCP1=178,SIG=SCCONC,DCP2=179&&186,TEI=0; > RXMOI:MO=RXOTRX-473-5,SC=0,DCP1=223,SIG=SCCONC,DCP2=224&&231,TEI=5; > RXMOI:MO=RXOTRX-473-1,SC=0,DCP1=187,SIG=SCCONC,DCP2=188&&

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 > 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 Eclipse? It has been

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) > 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: > #!/usr/bin/perl -w > 2 us

Re: Using regular expressions to populate a variable?

2015-01-18 Thread Jim Gibson
> On Jan 18, 2015, at 9:03 AM, Mike 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 populated wi

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 Oc

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 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 right-hand-side of t

Re: returning arrays

2014-09-09 Thread Jim Gibson
On Sep 9, 2014, at 2:09 PM, lee wrote: > Jim Gibson writes: > >> On Sep 8, 2014, at 3:13 PM, lee wrote: >> >>> Shawn H Corey writes: >>> >>>> On Mon, 18 Aug 2014 16:17:53 +0800 >>>> # or >>>> >>>> sub myf

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 writes: > >> On Mon, 18 Aug 2014 16:17:53 +0800 >> Ken Peng wrote: >> >>> sub myfunc { >>> my @x=(1,2,3); >>> return \@x; >>> } >>> >>> # or, >>> >>> sub myfunc { >>> my @x=(1,2,3); >>> return [@x]; >>> } >> >> # or >> >> sub myfu

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

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"; >

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, '<', $recapfil

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 sc

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

Re: Suddenly this script is not working!

2014-07-29 Thread Jim Gibson
On Jul 29, 2014, at 5:12 PM, ESChamp 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 information

Re: Suddenly this script is not working!

2014-07-29 Thread Jim Gibson
On Jul 28, 2014, at 3:59 PM, ESChamp 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 not the same as

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 > inc

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 wrote: > > On Jul 9, 2014, at 2:58 PM, Natxo Asenjo wrote: > > On Wed, Jul 9, 2014 at 10:35 PM, Jim Gibson wrote: > > On Jul 9, 2014, at 1:20 PM, Natxo Asenjo wrote: > &g

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 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

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: Need to Grep only fail count from the Pattern.

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

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: > &

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 unsubsc

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 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 ‘|’ and any whitespace

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-25 Thread Jim Gibson
On Jun 25, 2014, at 12:11 AM, Uday Vernekar 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 help you. > How wud

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: > >

Re: bash to perl for cgi

2014-06-17 Thread Jim Gibson
On Jun 17, 2014, at 1:10 AM, Philippe Rousselot 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 error message. D

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 d

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 u

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: 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: 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;&#

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

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, 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: > > /"[^"]*"/ > > This of course does

  1   2   3   4   5   6   7   8   9   10   >