Re: OOP: a class using a class that is descended from it?

2017-08-04 Thread Shawn H Corey
e more than one-to-one. :( A module is a file that has a *.pm extension. Example: Foo.pm A package is a name space that keeps its contents separate from other packages. -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For

Re: OOP: a class using a class that is descended from it?

2017-08-04 Thread Shawn H Corey
sed like that? Yes, they are called virtual classes. Aka generics in Java and interfaces in general. http://www.cs.utah.edu/~germain/PPS/Topics/interfaces.html -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: OOP: a class using a class that is descended from it?

2017-08-03 Thread Shawn H Corey
mon in both Foo and Bar and put them in a separate module. Then Foo and Bar can `use` it as their parent. -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Trap undefined barewords in subroutines

2017-08-02 Thread Shawn H Corey
T2M is undef eval $someVar; if( $@ ){ if( $@ =~ /^Bareword / ){ # process bare word error }else{ # some other error } }else{ # no errors. } -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org

Re: Filehandle within foreach loop

2017-07-16 Thread Shawn H Corey
7;t stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Filehandle within foreach loop

2017-07-12 Thread Shawn H Corey
-- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Perl invocations

2017-07-02 Thread Shawn H Corey
y not. -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i: $i\n";'

2017-07-01 Thread Shawn H Corey
ause !!$i is zero > > + How is this not a bug? Nope, no bug. > > + What is being printed here? !!$i which is !(!(0)) which is !(1) which is 0 > > + How do you do what I intended in perl? > How do we know what you intend? -- Don't stop where the ink doe

Re: is this reasonably save?

2017-05-14 Thread Shawn H Corey
On Sun, 14 May 2017 18:16:50 +0100 lee wrote: > Ok, do you see a way to do what I'm doing here by evaluating a block? > Simply remove it. $sth_cmds->bind_columns(@params); -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail:

Re: is this reasonably save?

2017-05-14 Thread Shawn H Corey
un` and search for /-T/ http://perldoc.perl.org/perlrun.html -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: postderef with subroutines

2017-05-11 Thread Shawn H Corey
ref? > Something like the not working code: > > $sub_ref->& ( 'and the camels go' ); > > Any idea? > { local @_ = ( 'and the camels go' ); $sub_ref->&*; } -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: How to delete multiple indices from array

2017-04-12 Thread Shawn H Corey
;t stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: How to delete multiple indices from array

2017-04-12 Thread Shawn H Corey
On Wed, 12 Apr 2017 18:16:56 -0400 Uri Guttman wrote: > On 04/12/2017 05:42 PM, Shawn H Corey wrote: > > On Wed, 12 Apr 2017 16:19:32 -0400 > > Uri Guttman wrote: > > > > > > my @array; > > > > for my $index (reverse sort @indices) { > >> so

Re: How to delete multiple indices from array

2017-04-12 Thread Shawn H Corey
from the highest index to the lowest. Otherwise the splice will shift the end of the array down, which messes up the indexing. > > > splice @array, $index, 0; > > > > > you need a length of 1 to remove the element. that line is a no-op. > > uri > -- Don'

Re: how to recursion

2017-03-29 Thread Shawn H Corey
nough. my_recursion(); > } > } More thoughts on recursion: https://lookatperl.blogspot.ca/2012/11/a-look-at-recursion.html -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Changing date format using carpout

2017-03-26 Thread Shawn H Corey
use CGI::Carp; { no warnings; local *CGI::Carp::stamp = sub { # new code } } -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Using PerlPod creatively

2017-03-24 Thread Shawn H Corey
2013/07/a-look-at-conditional-compiling-of.html use constant DEBUG => $ENV{DEBUG}; To use it: print "something\n" if DEBUG; -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-ma

Re: Installing Net::SFTP

2017-03-15 Thread Shawn H Corey
t IIRC, the command is: yum install zlib1g libssl -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Uninitialized Value, but It Isn't, so Why?

2017-03-02 Thread Shawn H Corey
rdest5 in numeric eq (==) at -e line > 1. Use of uninitialized value in numeric eq (==) at -e line 1. > i: > > Hah! "undef" is an uninitialized value ! $ perl -we 'if (not $interdest5) {$interdest5 = "";} print "|$interdest5|\n"' || $ perl -we 'if (! $interdest5) {$interdest5 = "";} print "|$interdest5|\n"' || -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Uninitialized Value, but It Isn't, so Why?

2017-03-02 Thread Shawn H Corey
cause you assign it a value in this statement: ($interdest5) = $sth_mex->fetchrow_array(); Change your if statement to: last if ! defined $interdest5; -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional com

Re: Converting string to float

2017-03-02 Thread Shawn H Corey
'work_hours' => '4.1', 'work_hours_to_float_try1' => '4.10', 'work_hours_to_float_try2' => '4.1', 'work_hours_to_float_try3' => '5.2' }; {"work_hours_to_float_try3":5.2,"work_hours_to_float_try1":"4.10","work_hours_to_float_try2":4.1,"work_hours":"4.1"} -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Free Books

2017-02-24 Thread Shawn H Corey
A short list of free Perl books. https://www.ossblog.org/grasp-perl-open-source-books/ -- Don't stop where the ink does. Shawn H Corey -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

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
not this valid method, that's all. TIMTOWTDI (There Is More Than One Way To Do It.) -- Don't stop where the ink does. Shawn H Corey -- 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 Shawn H Corey
On Thu, 10 Nov 2016 12:15:48 +0100 jaceke wrote: > sub escMe($) { Don't use sub prototypes. There are not the same as in C. They do something completely different. They are best not used until you know what they really do. :) -- Don't stop where the ink does. Shawn H

Re: Regex for matching files that don't have type extensions

2016-11-05 Thread Shawn H Corey
On Sat, 05 Nov 2016 21:30:12 + Aaron Wells wrote: > True. It could get hairy. Unicode is a pretty vast landscape, and I > think if you only want ASCII word characters to count as things that > could be in a filename, your original [A-Za-z0-9_] is your best bet. > Thanks to the others for thei

Re: Re-exec in perl

2016-10-04 Thread Shawn H Corey
a second alarm to go off before the first handler is finished. If it did, there's a chance of an infinite number of alarms to stack up, fill memory, and kill the process. -- Don't stop where the ink does. Shawn H Corey mailto:shawnhco...@nili.ca -- To unsubscribe, e

Re: Email Sender timeout with more than two paragraphs of text in body

2016-10-03 Thread Shawn H Corey
ties, you can use them with it. See http://perldoc.perl.org/5.8.9/perlop.html#Quote-and-Quote-like-Operators -- Don't stop where the ink does. Shawn H Corey mailto:shawnhco...@nili.ca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional command

Re: Remove Newlines from String

2016-09-06 Thread Shawn H Corey
( 0 .. 128 ); > > > > Oops. :) -- Don't stop where the ink does. Shawn H Corey mailto:shawnhco...@nili.ca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Remove Newlines from String

2016-09-06 Thread Shawn H Corey
about it more clearly, /x doesn't affect the replacement at all. True but /e does. ;) -- Don't stop where the ink does. Shawn H Corey mailto:shawnhco...@nili.ca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Remove Newlines from String

2016-09-06 Thread Shawn H Corey
[:print:]])/$HEXCODES{ord($1)}/g; $s =~ s/([^[:print:]])/$HexCodes{$1}/g; > > say "String after: $s"; > > END __END__ -- Don't stop where the ink does. Shawn H Corey mailto:shawnhco...@nili.ca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Some Perl Links

2016-05-30 Thread Shawn H Corey
Here is a list of Perl links: Official site http://www.perl.org/ Beginners' help http://learn.perl.org/faq/beginners.html Advance help http://perlmonks.org/ News http://perlsphere.net/ Documentation http://perldoc.perl.org/ Online Books http://www.perl.org/books/li

Re: Start a New Thread for a New Question (WAS: This is one of the things ...)

2016-05-13 Thread Shawn H Corey
On Fri, 13 May 2016 13:20:15 + "Walker, Michael E" wrote: > Hi, > > What framework are you all using for database development? When > tracking this thread back to the original message, I thought, "Nice > syntax." I am overall new to Perl, but am learning it for ETL at work. > > Thanks, > Mi

Re: This is one of the things ...

2016-05-13 Thread Shawn H Corey
On Fri, 13 May 2016 00:11:57 -0400 Uri Guttman wrote: > i stick to using fat comma ( => ) only for key/value pairs. it has > the side effect of quoting a bareword to the left which makes those > pairs easier to read. so i never use it just for a comma though i > have seen it used like that. this

Re: This is one of the things ...

2016-05-12 Thread Shawn H Corey
On Thu, 12 May 2016 21:35:02 -0400 Uri Guttman wrote: > my $holders = join ',', ('?') x @cgi_params ; > > and i like here docs for sql so i can see the sql and not need all > those quotes and noise. PBP recommends that you put short strings that are all punctuation in q{}, so they will be

Re: Are there (non-obvious) differences in string quoting methods?

2016-04-07 Thread Shawn H Corey
On Thu, 7 Apr 2016 16:28:36 +1200 Kent Fredric wrote: > On 7 April 2016 at 07:20, Jonathon Fernyhough > wrote: > > > > qq{} obviously wins when there would otherwise be a lot of > > escaping, but are there any downsides of using this method more > > generally (other than double-quotes being two

Re: Are there (non-obvious) differences in string quoting methods?

2016-04-06 Thread Shawn H Corey
On Wed, 6 Apr 2016 15:29:26 -0400 Uri Guttman wrote: > my rule is for the reader and not the computer. i try to use '' when > i know there is no interpolation and "" when there is. i am telling > the reader to either not look or to look inside the string. PBP recommends that yo use q{} for singl

Re: grep - block with start & end text

2016-03-19 Thread Shawn H Corey
On Fri, 18 Mar 2016 19:07:10 +0530 Prashant Thorat wrote: > Can you please help me to grep below 'block of text' from my file ? > this blocks occurs number of time & I want to grep all in between > lines of this block - > > first line is having - retr_test asm1 > & 4th line is having only - END

Re: reading directories using perl in windows

2016-03-13 Thread Shawn H Corey
On Sun, 13 Mar 2016 09:48:20 -0500 Mike Flannigan wrote: > > FYI, there is no error. If the directory > path has no spaces it works fine, if the directory > path has spaces it prints the path up to the 1st space > and just goes back to a cursor line. > > > Mike Yup. The default glob() functi

Re: Perl sort for reverse numeric if numbers and text are in a string, numbers first

2016-03-08 Thread Shawn H Corey
On Tue, 8 Mar 2016 13:29:40 -0800 Kenneth Wolcott wrote: > How do I call the built-in Perl sort function on an array of strings > where the string is composed of one or more digits, followed by a tab > which is followed by a string and I want the results to be sorted in > reverse numeric order?

Re: reading directories using perl in windows

2016-03-01 Thread Shawn H Corey
On Tue, 1 Mar 2016 15:53:15 +0530 Arghya Das wrote: > use warnings; > > $dir = "c:/folder/*";my @files = glob( $dir ); > foreach (@files ){ >print $_ . "\n";} > > > i am trying to read windows directory using above code but it gives > errors in recognising tthe directory path. please help.

Re: coding help

2016-03-01 Thread Shawn H Corey
On Tue, 1 Mar 2016 12:05:14 +0530 Arghya Das wrote: > $num = 1234; > $sum = 0; > > while ( $num != 0) > { > $rem = $num % 10; > $sum = ( $sum * 10 ) + $rem; > $num = $num / 10; $num = int( $num / 10 ); > } > > print $sum; > > > > please tell what is wrong with the reverse number code .

Re: use of bless

2016-02-28 Thread Shawn H Corey
On Sun, 28 Feb 2016 08:59:20 + rakesh sharma wrote: > > HI all > > I am using object oriented perl and saw return self as well as bless > being used According to docs bless returns the reference to self. Why > should we use both statements in the new method > > Sent from Mail

Re: preventing concurrency between five different perl scripts

2016-02-24 Thread Shawn H Corey
On Wed, 24 Feb 2016 18:47:09 +0200 Shlomi Fish wrote: > Hello Kenneth, > > On Tue, 23 Feb 2016 18:34:54 -0800 > Kenneth Wolcott wrote: > > > Hi; > > > > This seems like a very simple concept, but I'm not getting it, so > > I'd like some help. > > > > So part of this is perl (not understa

Re: Counter Help

2016-02-12 Thread Shawn H Corey
On Fri, 12 Feb 2016 12:08:07 -0500 Uri Guttman wrote: > hashes are very easy to learn. and once you get the hang of them you > will wonder why you waited so long. If keeping the data ordering is important, use an array. Otherwise, use a hash. :) -- Don't stop where the ink does. Shaw

Re: Regex to match "bad" characters in a parameter

2016-01-25 Thread Shawn H Corey
On Mon, 25 Jan 2016 16:16:40 -0800 SSC_perl wrote: > I'm trying to find a way to trap bad item numbers. I want to > parse the parameter "itemid=" and then everything up to either an "&" > or end-of-string. A good item number will contain only ASCII > letters, numbers, dashes, and undersco

Re: Is perl user specific

2016-01-06 Thread Shawn H Corey
On Wed, 6 Jan 2016 21:04:39 +0530 Ankita Rath wrote: > I am trying to execute some perl scripts. I am getting following > error. But other user in the same server are not getting the error. > So can anybody help me understanding this problem. And why other user > are not getting the error. > > P

Re: scp_put failing when there are too many files

2015-12-11 Thread Shawn H Corey
On Fri, 11 Dec 2015 19:55:15 +0200 Shlomi Fish wrote: > Of note here is Rob Pike's note about the argument list being limited > in size on UNIX-systems here: Yeah but usually it's a high number like 32767. :) -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: beginne

Re: scp_put failing when there are too many files

2015-12-11 Thread Shawn H Corey
On Fri, 11 Dec 2015 16:28:39 +0100 Ori Raz wrote: > Hi, > Did anyone encounter the scenario where scp_put is failing (too many > arguments) when the directory contains too many files? > We have 36K files in the directory and it is failing... (with lower > amount it works fine) > > This is how we

Re: regex problem?

2015-11-25 Thread Shawn H Corey
On Wed, 25 Nov 2015 17:22:04 + Andrew Solomon wrote: > The only problem I can see is that you want UPPERCASE-1234 and your > regex has lowercase. Try > > (\A[A-Z]+) # match and capture leading alphabetics Please put the anchor outside the capture. And you could use the POSIX conventions:

Re: passwords in Perl

2015-10-27 Thread Shawn H Corey
On Tue, 27 Oct 2015 12:25:38 -0400 shawn wilson wrote: > Oh, and this is one place where you *don't* give lots of details of > what went wrong. Don't say "invalid user", don't say "bad password", > say "Bad username or password". and exit 1 if your failure is at a cli > - that's it Print the err

Re: Multi line file handling

2015-10-19 Thread Shawn H Corey
On Mon, 19 Oct 2015 19:48:06 +0530 Prashant Thorat wrote: > Hi All, > > I have a file with multiple lines ,I want to assign all content to > variable & then want to work on it. > Like want to match pattern /window/ from it. > how can it is possible ? > for example - > > open ( F1 ,"file.txt") |

Re: access hash in specific sequence

2015-09-03 Thread Shawn H Corey
On Thu, 3 Sep 2015 17:42:48 +0100 Gary Stainburn wrote: > I have a hash of hashes which I converted to an array of hashes > because I needed to access them in a specific sequence. It now looks > like > > my @pagetypes=( > {'pagetype'=>'Delivery Note','weight'=>2,. > {'pagetype'

Re: Perl beginner

2015-07-30 Thread Shawn H Corey
FYI: some useful Perl links. • Official site • Beginners' help • Advance help • News • Documentation • Online Books

Re: convert linear array to nested structure

2015-07-21 Thread Shawn H Corey
On Tue, 21 Jul 2015 13:35:37 -0700 Jim Gibson wrote: > The data structure you have shown is not very efficient in tems of > data storage. Is this the actual data structure, or is it part of > something more complicated. For exampe, a more efficient use of space > would be this, which uses nested

Re: Display a hash in the order of an array

2015-07-17 Thread Shawn H Corey
On Fri, 17 Jul 2015 15:11:13 +0200 Vincent Lequertier wrote: > Hi, > > I have the following structure : > > $hash{$date} = { > 'ip' => $ip, > 'action' => $action, > }; > > witch produce data like : > > $VAR1 = '[15/Jul/2015:10:3

Re: Debugging and passing constant value at run time

2015-07-07 Thread Shawn H Corey
On Tue, 7 Jul 2015 07:27:49 -0700 (PDT) Ron Bergin wrote: > Using a DEBUG constant and assigning its value via an environment > variable are both common, but has a drawback and would not be my > choice of approach. I prefer to use a lexical var (with file scope) > and assign it via command line o

Re: Debugging and passing constant value at run time

2015-07-07 Thread Shawn H Corey
On Tue, 7 Jul 2015 11:40:35 + "Sharanbasappa Raghapur, ERS, HCLTech" wrote: > I am using constant mainly to enable printing of debugging messages > (e.g. use constant DEBUGGING_L1 => 0;) Normally, the value is '0' and > when I need to see debug messages, I make this 1 and run the script. > >

Re: Customized Module Concept

2015-07-03 Thread Shawn H Corey
On Fri, 3 Jul 2015 12:48:22 +0530 ayush kabra wrote: > Hi Team, > > I want to make customized module on perl but i don't know how to make > it. i have checked on google but it's little bit confusing. i am not > able to understand what is the meaning of EXPORTER_OK ,IMPORT and > there is lot of t

Re: Getting 2/8 as output

2015-06-17 Thread Shawn H Corey
On Wed, 17 Jun 2015 08:29:10 -0500 Mike Flannigan wrote: > If I am not mistaken there is no $, variable in Perl. > Correct me if I am wrong. http://perldoc.perl.org/perlvar.html and search for /\$OUTPUT_FIELD_SEPARATOR/ -- Don't stop where the ink does. Shawn -- To unsubscribe, e-ma

Re: Strange

2015-06-12 Thread Shawn H Corey
On Fri, 12 Jun 2015 07:43:59 +0200 Jerry Rocteur wrote: > What happened to the list ? Where has everybody gone to ? stackoverflow.com -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@per

Re: When is qw used

2015-06-10 Thread Shawn H Corey
On Wed, 10 Jun 2015 17:49:44 +0530 rakesh sharma wrote: > I have seen perl syntax like use Carp qw(some list items)so when do > we need to write like this and why is not the items of the module > getting imported As others have said, to import a selected set of functions or to import functions n

Re: Compilation fails with Padre (a Perl IDE) on RHEL-based distros (CentOS, etc.)

2015-05-26 Thread Shawn H Corey
On Tue, 26 May 2015 11:53:55 -0400 "someone called" wrote: > I tried but failed (wxWidgets is a requirement of Padre) as root: Wx requires some development libaries: libgconf*-dev libgtk*-dev libgstreamer*dev libgstreamer-plugins-base*-dev where * is to be replace with the version number, if an

Re: Can u suggest me the best ide for perl

2015-05-21 Thread Shawn H Corey
On Thu, 21 May 2015 10:21:07 +0200 Li Xue wrote: > Just realized that I replied only to Gary. Here is how to use vim as > perl IDE. VIM-based perl IDE is my favoriate because it saved me lots > of time in debugging and in tidying up my code. I used eclipse before > and the perl plugin is too bugg

Re: Removing text

2015-05-18 Thread Shawn H Corey
On Mon, 18 May 2015 17:32:03 +0200 Richard Taubo wrote: > Hi! > > Trying to remove the literal text "%st" from the command line return > value: 0.0%st as in: > [$] printf "0.0%st" | perl -pe 's/\%st//' > > I have also tried: > > [$] printf "0.0%st" | perl -pe 's/\Q%st\E//' > > Neither works.

Re: Perl array question

2015-05-06 Thread Shawn H Corey
On Wed, 6 May 2015 12:49:53 +0530 Anirban Adhikary wrote: > Hi List > I have the following array --- > ('1900-0','1900-1','NULL','NULL','1900-2','1900-4','1902-5','1902-6','1902-7','1902-8'); > There are two part for each element separated by a dash. > first one known as earfcn and second one is

Re: Need explanation of code

2015-04-12 Thread Shawn H Corey
On Sat, 11 Apr 2015 21:20:22 -0700 SSC_perl wrote: > Could someone please explain the difference between: > > %{$self->{'DATA'}} = () } %{ $self->{'DATA'} } = (); > > and > > $self->{'DATA'} = {} > > I was told that they are equivalent, but they're not. One > works and the ot

Re: How to handle null elements inside an array

2015-04-02 Thread Shawn H Corey
On Thu, 2 Apr 2015 08:34:37 -0700 SSC_perl wrote: > On Apr 2, 2015, at 7:43 AM, Anirban Adhikary wrote: > > When I am trying to split the line based on whitespace > > @elements = split(/\s+/,$line); > > It will be interesting if someone can come up with a solution > to this, but I don't se

Re: Good books to study perl interpreter

2015-03-30 Thread Shawn H Corey
On Mon, 30 Mar 2015 22:12:51 +0530 rakesh sharma wrote: > Hi all > > Please suggest nice books to know perl interpreter. In depth books is > that i am looking for. > > Thanks > Rakesh FYI: some useful Perl links. • Official site • Beginners' help

Re: Regular Expression Help.

2015-03-25 Thread Shawn H Corey
On Wed, 25 Mar 2015 10:31:40 +0530 Frank Vino wrote: > Hi Team, > > How to understand Regular Expression in a easy way? > > Thanks, > Frank Sorry Frank but there's no easy way. ☹ Some things to remember: Some punctuation marks have special meaning, like periods, question marks, and asterisks

Re: "$CONFIG_FILE"

2015-02-20 Thread Shawn H Corey
On Fri, 20 Feb 2015 13:38:42 +0100 "nicolas " wrote: > jupiter@jupiter-OptiPlex-755:~/Documents/base-0.50$ ./base.pl -i > words Global symbol "$CONFIG_FILE" requires explicit package name > at vowCons2.pm line 18. Go to line 18 of vowCons2.pm and change: $CONFIG_FILE to: $CONFIG_FILE -- Don'

Re: Finding my localtime

2015-02-04 Thread Shawn H Corey
On Wed, 4 Feb 2015 11:21:32 -0800 SSC_perl wrote: > I'm trying to break out a timestamp into it's appropriate fields, > like so: > > my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = > localtime($my_time); > > but no matter if I use localtime or gmtime, $my_time gets analyzed a

Re: Debug when script WILL NOT RUN

2015-02-02 Thread Shawn H Corey
On Mon, 02 Feb 2015 11:54:12 -0500 Harry Putnam wrote: > Are we even talking about the same program... Perl::Critic/perlcritic? > > For me, it just blows up with piles of help information when I use > `-c': Use the -c option with `perl`, not `perlcritic`. Perl::Critic is the Perl module that y

Re: Debug when script WILL NOT RUN

2015-02-01 Thread Shawn H Corey
On Sun, 01 Feb 2015 18:07:18 -0500 Harry Putnam wrote: > Shawn H Corey writes: > > > On Sun, 01 Feb 2015 11:12:46 -0500 > > Harry Putnam wrote: > > > >> Shawn H Corey writes: > >> > >> > http://metacpan.org/pod/Perl::Critic > >&g

Re: Debug when script WILL NOT RUN

2015-02-01 Thread Shawn H Corey
On Sun, 01 Feb 2015 11:12:46 -0500 Harry Putnam wrote: > Shawn H Corey writes: > > > http://metacpan.org/pod/Perl::Critic > > Feeding my sorry script to the advertised webpage like by using the > posted method of testing Perl::Critic with no installation. I have inst

Re: Debug when script WILL NOT RUN

2015-02-01 Thread Shawn H Corey
On Sun, 1 Feb 2015 14:08:24 + (UTC) ThankGod Ebenezer wrote: > Please can you remove me from this list? No. But see the link below; the one marked "unsubscribe". :) -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional c

Re: Debug when script WILL NOT RUN

2015-02-01 Thread Shawn H Corey
On Sun, 1 Feb 2015 00:10:30 -0800 Charles DeRykus wrote: > One good sleuthing tool is perltidy (perltidy.sourceforge.net) which > is good at unraveling a rat's nest of errors to tease out the > culprit: You can also download and install with `cpan`: cpan Perl::Tidy Another good tool to ha

Re: question of what can respond to die [...]

2015-01-27 Thread Shawn H Corey
On Tue, 27 Jan 2015 09:37:15 -0500 Harry Putnam wrote: > #!/usr/local/src/test/bin/perl > > use strict; > use warnings; > use Cwd 'abs_path'; > > my $tdir = shift; > You can use `-e` to determine if the path exists and `-d` to determine if it's a directory. See `perldoc -f -X` and search for

Re: question of what can respond to die [...]

2015-01-27 Thread Shawn H Corey
On Tue, 27 Jan 2015 10:48:43 -0500 Brandon McCaig wrote: > It would not be very pleasant if most things die() on error because > errors are normal and usually we don't want robust programs to crash > when something innocent fails, nor do we want to have to wrap every > error that we can recover f

Re: Looping regexes against a list

2015-01-20 Thread Shawn H Corey
On Tue, 20 Jan 2015 17:47:58 + Mike Martin wrote: > Take a load of Job Vacancy posts (xml files - loads of) > Parse the Information, getting rid of as much garbage as possible > Push a distinct list into a lookup hash If you're running Linux (or any POSIX), see `man sort` and search for /-u/

Re: Looping regexes against a list

2015-01-20 Thread Shawn H Corey
What the OP should do is put the regexes in a Perl module and unroll the loop. That way, he can group them so that groups of tests are skipped: # strings containing "foo" if( /foo/ ){ return "food" if /food/; return "fool" if /fool/; return "foot" if /foot/; return "foo"; } --

Re: Looping regexes against a list

2015-01-20 Thread Shawn H Corey
On Tue, 20 Jan 2015 10:23:42 -0500 Brandon McCaig wrote: > On Tue, Jan 20, 2015 at 10:21 AM, Brandon McCaig > wrote: > > perldoc -f qr// > > I was sure that worked in my up-to-date perlbrew environments, but it > isn't working in Cygwin running perl 5.14.2 so in the event that it > doesn't work

Re: Looping regexes against a list

2015-01-19 Thread Shawn H Corey
On Mon, 19 Jan 2015 11:43:41 -0500 John Mason wrote: > On Mon, Jan 19, 2015 at 11:36 AM, Shawn H Corey > wrote: > > > On Mon, 19 Jan 2015 11:18:01 -0500 > > bill pemberton wrote: > > > > > I fail to see why a regex can only be changed by a progr

Re: Looping regexes against a list

2015-01-19 Thread Shawn H Corey
On Mon, 19 Jan 2015 11:18:01 -0500 bill pemberton wrote: > I fail to see why a regex can only be changed by a programmer. please > expand upon this. Regex is a programming language in its own right. Why should an average user have any knowledge of it? -- Don't stop where the ink does.

Re: Looping regexes against a list

2015-01-19 Thread Shawn H Corey
On Mon, 19 Jan 2015 15:57:35 + Andrew Solomon wrote: > On Mon, Jan 19, 2015 at 2:50 PM, Mike Martin > wrote: > > The lookup hash is like this > > %clean=( > > HeatingEngineer => (?:Heating.*?Engineer)\b.*? > > HGV > > Driver=>(?=\A(?:(?!tech|mech).)*$)(?:HGV|LGV|Class.?1|Class.?2).?(?

Re: Parsing multi column files

2015-01-18 Thread Shawn H Corey
On Sun, 18 Jan 2015 19:00:05 -0500 Mike wrote: > sub gen_ins { > open(FH, '<', 'insults2.txt') or die "[-] ERROR: Can't find > insult list."; > my @cols = split (" ", ); > print "$cols[0]"; > close FH; > } > > gen_ins(); > > When currently run, gen_ins() will print out the f

Re: Using regular expressions to populate a variable?

2015-01-18 Thread Shawn H Corey
On Sun, 18 Jan 2015 11:49:11 -0500 Mike wrote: > Hey everyone, I'm trying to find information on how I can use regular > expressions to populate a variable. > > I want to pull text between one set of characters and another set of > characters and use that to populate my variable. Can anyone po

Re: How does opendir/readdir process files

2015-01-15 Thread Shawn H Corey
On Thu, 15 Jan 2015 17:27:03 -0500 Harry Putnam wrote: > When Brandan said that to me... other than the RTFM it sailed right > over my head... so what does tl;dr mean? tl;dr == too long; didn't read -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: beginners-unsubs

Re: How does opendir/readdir process files

2015-01-14 Thread Shawn H Corey
On Tue, 13 Jan 2015 22:40:46 -0500 Brandon McCaig wrote: > my @files = map { $_->[0] } >sort { $a cmp $b } sort { $a->[1] <=> $b->[1] } >map {[$_, (stat("$dir/$_"))[9] ] } >grep { ! /^\./ && -f

Re: Back to work on perl + gui + hebrew...

2015-01-12 Thread Shawn H Corey
On Mon, 12 Jan 2015 15:23:53 +0200 Shlomi Fish wrote: > Actually, Perl/Qt and Perl/KDE should also support Hebrew, > Bidirectionality, and internationalisation well. Maybe wxPerl too > (not sure). See: > > http://perl-begin.org/uses/GUI/ I think wxWidgets supports UTF by default. See: http://do

Re: Multi-line `find` commands

2015-01-01 Thread Shawn H Corey
On Thu, 1 Jan 2015 15:11:36 -0800 SSC_perl wrote: > Thanks, guys. I appreciate the responses. I couldn't get > either of those solutions to work so I'll switch over to using > File::Find. I don't know why I didn't think of that before - I use > it in other scripts. :\ I guess I was just

Re: Is There a Way to Make Uninitialized Warnings Fatal?

2014-12-11 Thread Shawn H Corey
On Wed, 10 Dec 2014 17:04:42 -0500 Uri Guttman wrote: > it is called magic goto for that reason. it isn't really a sub call > but a replacement of the current sub with the called one. no stack > work is done and @_ is passed as is. it is very valuable when used > like that but rarely needed. when

Re: Is There a Way to Make Uninitialized Warnings Fatal?

2014-12-10 Thread Shawn H Corey
On Wed, 10 Dec 2014 11:32:16 -0600 "Martin G. McCormick" wrote: > it made me wonder if there is a way to cause a perl program > to die if that condition exists? See `perldoc warnings` and search for /Fatal Warnings/ http://perldoc.perl.org/warnings.html#Fatal-Warnings -- Don't stop where the

Re: Substitution operator is not working in perl - Windows OS

2014-12-04 Thread Shawn H Corey
On Thu, 4 Dec 2014 16:06:26 +0530 Jitendra Barik wrote: > My code is: > > $version1 = "JITENDRA"; > tie @array,Tie::File,"$rtf1" or die($!); > > for(@array){ > #print "Hi"; > s/\%VERSIONS\%/$version1/g; > > > } > untie(@array); > > FILE: > ***

Re: reading a hash of arrays

2014-11-19 Thread Shawn H Corey
On Wed, 19 Nov 2014 17:03:40 -0600 "Frank K." wrote: > I can't do @array1 = @hash{one}; @array1 = @{ $hash{one} }; $hash{one} contains a reference to an array. By dereferencing it with @{ ... }, you get the array. -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: b

Re: using string as module

2014-11-08 Thread Shawn H Corey
On Sat, 8 Nov 2014 17:48:31 +0200 Shlomi Fish wrote: > The correct syntax is simply (untested): > > my $foo = "MyFoo::${pgm}Bar"->new; FYI: That is called a symbolic reference. For more information, see `perldoc perlref` and search for /Symbolic references/ BTW, symbolic references are n

Re: share a variable between files

2014-10-09 Thread Shawn H Corey
On Wed, 8 Oct 2014 21:36:06 +0200 Hans Ginzel wrote: > I want to use one global hash variable for options or configuration > variables like verbose, debug. I don't want to pass them to each > function or to almost each object. package main; our %Opts = ( verbose => 0, debug => 0. ); # yo

Re: map vs foreach

2014-09-30 Thread Shawn H Corey
On Tue, 30 Sep 2014 16:38:24 -0700 SSC_perl wrote: > On Sep 30, 2014, at 4:08 PM, Shawn H Corey wrote: > > code like you will have to read it after an all-night party > > (some day, you will). > > Those days are over, but point taken! ;) They're never over but

Re: map vs foreach

2014-09-30 Thread Shawn H Corey
On Tue, 30 Sep 2014 14:08:14 -0700 SSC_perl wrote: > Is the output of these two lines equivalent? > > map { $hash->{$_} = shift @record } @{$self->{'FIELDNAMES'}}; > > $hash->{$_} = shift @record foreach @{$self->{'FIELDNAMES'}}; > > They appear to be in my testing, but I'd like to

Re: Any project like Ipython/Bpython in Perl.

2014-09-15 Thread Shawn H Corey
On Mon, 15 Sep 2014 08:45:14 +0530 Santosh Kumar wrote: > I have seen some quick help option in some of the interpreters in > python like Ipython and bpython. Do we have similar kind of projects > or interpreter tools which i can start using in perl. I don't know what Python is doing buy have yo

Re: Books or links or knowledge base

2014-09-13 Thread Shawn H Corey
On Sat, 13 Sep 2014 13:24:45 +0530 Santosh Kumar wrote: > Any good pointers or links on learning perl . Also any good pointer > on OOPS concepts. Some useful Perl links. * Official site * Beginners' help * Adv

  1   2   3   4   5   6   7   8   9   10   >