Re: lexical scope

2012-06-05 Thread Steve Bertrand
On 05/06/2012 6:31 PM, Steve Bertrand wrote: On 05/06/2012 3:49 PM, Shawn H Corey wrote: On 12-06-05 05:43 PM, Bill Stephenson wrote: Maybe this is what you need? #!/usr/bin/perl use warnings; use strict; my @array; while ( my $line = ) { chomp $line; push (@array = split(/\s+/, $line,-1

Re: lexical scope

2012-06-05 Thread Steve Bertrand
On 05/06/2012 3:49 PM, Shawn H Corey wrote: On 12-06-05 05:43 PM, Bill Stephenson wrote: Maybe this is what you need? #!/usr/bin/perl use warnings; use strict; my @array; while ( my $line = ) { chomp $line; push (@array = split(/\s+/, $line,-1)); push @array, [ split /\s+/, $line, -1 ]; I

Re: shift vs @_

2012-05-21 Thread Steve Bertrand
On 2012-05-21 21:10, David Christensen wrote: On 05/21/2012 12:40 PM, sono-io wrote: David, Are you saying that it would be faster to do: my $this_date = shift; my $output = shift; as opposed to: my ($this_date, $output) = @_; or am I not reading your assessment correctly? 1. Benchmarking on t

Re: shift vs @_

2012-05-21 Thread Steve Bertrand
On 2012-05-21 14:51, Shawn H Corey wrote: On 12-05-21 04:32 PM, Steve Bertrand wrote: On 2012-05-21 14:12, sono...@fannullone.us wrote: Hi Paul, Please don't care about this until your code is running correctly but too slowly and profiling has determined that this is the bottleneck.

Re: shift vs @_

2012-05-21 Thread Steve Bertrand
On 2012-05-21 14:12, sono...@fannullone.us wrote: Hi Paul, Please don't care about this until your code is running correctly but too slowly and profiling has determined that this is the bottleneck. I'm curious as to why you say this. If one way is faster than another, wouldn't it be

Re: shift vs @_

2012-05-21 Thread Steve Bertrand
On 2012-05-21 13:40, sono...@fannullone.us wrote: On May 20, 2012, at 10:07 PM, David Christensen wrote: I've updated function_arguments.pl with Benchmark, below. f_direct() is the fastest, f_shift() is in the middle (12% slower), and f_assign() is the slowest (37%). David, Are you

Re: Using the ternary operator to concat a string not working like I think?

2012-04-03 Thread Steve Bertrand
On 2012-04-03 18:55, timothy adigun wrote: Hi Stan, Please check my comments below: $test{one} eq "first" ? $test{one} .= " is the worst\n" : ( $test{two} .= " is the best\n"); This is not what the ternary (conditional operator) is for. As I said in my last post, it is used f

Re: Using the ternary operator to concat a string not working like I think?

2012-04-03 Thread Steve Bertrand
On 2012-04-03 17:39, Stan N/A wrote: I've run into a weird issue where the ternary operator isn't doing what I believe it normally would and need some help understanding the issue. I'm sure I'm missing some critical point, but perhaps this is an issue with perl. Here's a short 14 line script exem

Re: Proc::PID::File - non-default location

2012-03-27 Thread Steve Bertrand
On 2012-03-27 08:36, Mendor wrote: Hello, I'm trying to write some daemon application using Proc::Daemon and Proc::PID::File modules. But I've encountered that Proc::PID::File crashes when I'm trying to put lockfile to a non-default location. E.g. the part of code: my $pid = Proc::PID::File->ne

Re: printing hashes

2012-03-25 Thread Steve Bertrand
On 2012-03-25 23:15, Chris Stinemetz wrote: ok. You didn't do anything wrong per-se, all you did was try to go one level too deep into your data structure. $cell (eg 149) was the name of the key for the top-level %hash container. All hash keys can only have one value associated with it. In t

Re: printing hashes

2012-03-25 Thread Steve Bertrand
On 2012-03-25 22:39, Chris Stinemetz wrote: Use a block sort to sort numerically: perl -E '%h=qw(3 a 2 b 1 c 4 d); say sort { $a<=>$b } keys %h;' Show us what you have so far if you need help with a specific code segment. references are still a bit foreighn to me. Below is the error I am ge

Re: printing hashes

2012-03-25 Thread Steve Bertrand
On 2012-03-25 22:13, Chris Stinemetz wrote: Any advice on how to include a numerical sort on the second key? I've been trying to resolve this for a while and have had no luck. Use a block sort to sort numerically: perl -E '%h=qw(3 a 2 b 1 c 4 d); say sort { $a<=>$b } keys %h;' Show us what y

Re: printing hashes

2012-03-25 Thread Steve Bertrand
On 2012-03-25 12:02, Chris Stinemetz wrote: How would I return the values along with the keys that meet the criteria from the sub routine? On Mar 25, 2012 10:04 AM, "Rob Dixon" wrote: Keeping with the use of $_, replace the following 'print map' statement to the following: print map "$_

Re: work with hexadecimal values

2012-03-08 Thread Steve Bertrand
On 2012-03-08 08:24, sunita.prad...@emc.com wrote: Hi I have one range of hexadecimal numbers like : 415A till 415F . I need to find all other numbers between this 2 . Is there any Perl function which will help to find all numbers or any other way in Perl ? You wanted to find out the numbers

Re: work with hexadecimal values

2012-03-08 Thread Steve Bertrand
On 2012-03-08 08:41, John W. Krahn wrote: sunita.prad...@emc.com wrote: Hi Hello, I have one range of hexadecimal numbers like : 415A till 415F . I need to find all other numbers between this 2 . Is there any Perl function which will help to find all numbers or any other way in Perl ? $ pe

Re: work with hexadecimal values

2012-03-08 Thread Steve Bertrand
On 2012-03-08 08:41, John W. Krahn wrote: sunita.prad...@emc.com wrote: Hi Hello, I have one range of hexadecimal numbers like : 415A till 415F . I need to find all other numbers between this 2 . Is there any Perl function which will help to find all numbers or any other way in Perl ? $ pe

Re: Access class symtab by dereferencing an object

2012-03-03 Thread Steve Bertrand
On 2012-03-03 14:18, Paul Johnson wrote: On Sat, Mar 03, 2012 at 01:51:28PM -0500, Steve Bertrand wrote: Is there a proper way to do this that someone could point out? no strict "refs"; foreach my $entry ( keys %{ ref($dog) . "::" }) But why? If you really need class i

Access class symtab by dereferencing an object

2012-03-03 Thread Steve Bertrand
Hi all, I have a need to examine and manipulate certain aspects of a class symbol table. I can do this: my $dog = Animal->new(); foreach my $entry ( keys %Animal:: ){ ... } ...but what I'd like to do is dereference the object itself to get the class, as there will be times I won't know w

Re: read from command line

2012-03-03 Thread Steve Bertrand
On 2012-03-03 09:08, lina wrote: $ perl extract.pl try.tex Bareword "filename" not allowed while "strict subs" in use at extract.pl line 8. Execution of extract.pl aborted due to compilation errors. #!/usr/bin/env perl use strict; use warnings; Good. my $filename = $ARGV[0] ; open FILE, "

Re: Can recursion eliminate nested foreach() loops?

2012-02-26 Thread Steve Bertrand
On 2012-02-26 23:55, Rob Dixon wrote: On 27/02/2012 02:30, Steve Bertrand wrote: I know this isn't a beginner's question, but I know there are geniuses here. Is there a way to simplify this within Perl? Hi Steve Much of the complexity comes from working with the nested data

Re: Can recursion eliminate nested foreach() loops?

2012-02-26 Thread Steve Bertrand
On 2012-02-26 21:52, Shawn H Corey wrote: On 12-02-26 09:30 PM, Steve Bertrand wrote: I know this isn't a beginner's question, but I know there are geniuses here. Is there a way to simplify this within Perl? There is no simplify way of doing this. Separate off the first attribute

Re: Can recursion eliminate nested foreach() loops?

2012-02-26 Thread Steve Bertrand
On 2012-02-26 21:52, Shawn H Corey wrote: On 12-02-26 09:30 PM, Steve Bertrand wrote: I know this isn't a beginner's question, but I know there are geniuses here. Is there a way to simplify this within Perl? There is no simplify way of doing this. Separate off the first attribute

Can recursion eliminate nested foreach() loops?

2012-02-26 Thread Steve Bertrand
I came across a question early this morning on a forum that intrigued me. I literally spent about five hours trying everything to solve it, but I couldn't. Every attempt at recursion, counting, numbering, hashing etc failed. Is there a way to use recursion to eliminate the repeated and pre-ca

perl -E

2012-02-24 Thread Steve Bertrand
Hi all, Lately, I have seen many command-line one-liners floating around with the -E argument: perl -E '#do stuff' Could somebody kindly remind me which perldoc I need to review to find out about the differences between -e and -E? Steve -- To unsubscribe, e-mail: beginners-unsubscr...@per

Re: something about "strict"

2012-02-14 Thread Steve Bertrand
On 2012.02.14 15:12, timothy adigun wrote: On Tue, Feb 14, 2012 at 9:02 PM, Uri Guttman wrote: On 02/14/2012 02:38 PM, timothy adigun wrote: Hi Uri, On Tue, Feb 14, 2012 at 6:07 PM, Uri Guttman wrote: On 02/14/2012 12:02 PM, timothy adigun wrote: Hi lina, you could also use:

Re: unexpected results

2012-02-08 Thread Steve Bertrand
On 2012.02.08 23:44, lina wrote: my @strings = ( "Fred and Barney", "Gilligan or Skipper", "Fred and Ginger" ); ...brings back memories of a book that Randal authored a few years ago, which made Perl references 'click' for me. (poor Gilligan, he d

Re: Perl Module to parse any other Perl script/module to fetch stats about data-structures

2012-02-08 Thread Steve Bertrand
On 2012.02.08 17:20, Parag Kalra wrote: Do we have any Perl module which can parse any other perl script (or module) and fetch information like total number of arrays being used, total number of hashes, total number of scalar variables etc and size information (like total elements, total keys e

Re: Foreach loop and hash of arrays

2012-02-06 Thread Steve Bertrand
On 2012.02.06 16:14, sono...@fannullone.us wrote: I have a web form where people enter their address info and I want to make sure that the first three digits of their Zip Code correspond to their State. So I'm creating a hash of arrays that contains a list of Zip Codes for the

Re: Parsing a microarray data file

2012-01-26 Thread Steve Bertrand
On 2012.01.26 12:59, Chris Stinemetz wrote: Hello Tiago, On Thu, Jan 26, 2012 at 11:08 AM, Tiago Hori wrote: Hi All, I need some help to get started on a script. I have these huge data files 16K rows and several columns. I need to parse the rows into a subset of these 16K rows. Each rows has

Re: Unique list

2010-09-16 Thread Steve Bertrand
On 2010.09.16 11:27, Jordi Durban wrote: > Hi all! > I would like to ask you something. I have a file as follows: > File A File B > uid = 1 uid = 4 > uid = 2 uid = 3 > uid = 3 uid = 2 > uid = 4 uid = 1 > > I'm trying to make a perl script to get me only th

Re: script for shutdown remote machine

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

Re: Accessing array from Perl & DBI using Template Toolkit

2010-08-11 Thread Steve Bertrand
On 2010.08.11 00:15, MySelf rdtan.net wrote: > On 10/08/10 4:49, Dermot wrote: >> I think you might be getting a bit confused here. TT requires >> references for it's parameters variable, so yes array, hash references >> (or any reference that returns a list) but that is different from how >> you

Re: Piping commands into cli perl

2010-07-12 Thread Steve Bertrand
On 2010.07.12 10:31, Shlomi Fish wrote: > On Monday 12 Jul 2010 17:18:12 Steve Bertrand wrote: >> On 2010.07.09 21:57, Uri Guttman wrote: >>>>>>>> "SB" == Steve Bertrand writes: >>> SB> On 2010.07.09 21:40, Uri Guttman wrote: >>>

Re: Piping commands into cli perl

2010-07-12 Thread Steve Bertrand
On 2010.07.09 21:57, Uri Guttman wrote: >>>>>> "SB" == Steve Bertrand writes: > > SB> On 2010.07.09 21:40, Uri Guttman wrote: > > >> what input? i see none there. but what you want is either -p or -n. both > >> are among t

Re: Piping commands into cli perl

2010-07-09 Thread Steve Bertrand
On 2010.07.09 21:57, Uri Guttman wrote: >>>>>> "SB" == Steve Bertrand writes: > > SB> On 2010.07.09 21:40, Uri Guttman wrote: > > >> what input? i see none there. but what you want is either -p or -n. both > >> are among t

Re: Piping commands into cli perl

2010-07-09 Thread Steve Bertrand
On 2010.07.09 21:40, Uri Guttman wrote: >>>>>> "SB" == Steve Bertrand writes: > > SB> But alas, I get nothing, so I tried this as my last line, thinking that > SB> the input would be put in $_: > > SB> perl -e '$_ =~ s/.*\s+//;

Piping commands into cli perl

2010-07-09 Thread Steve Bertrand
I have slowly been finding using perl at the cli more and more useful, but I'm confused as to how to do certain tasks. Although the following pipeline is hugely ugly and I know that it can be shortened extremely, from time-to-time I just like to play around with all manner of manipulation. So, Per

Re: I don't wont to create more lines of code then the necessary

2010-07-09 Thread Steve Bertrand
On 2010.07.09 08:34, Robert Wohlfarth wrote: > On Fri, Jul 9, 2010 at 5:16 AM, marcos rebelo wrote: > >> the fact of or not the prototype in the xpto function, I get this >> warning: 'Use of implicit split to @_ is deprecated at script.pl line >> 5.' >> >> use strict; >> use warnings; >> >> sub x

Re: Substitution Problem

2010-06-28 Thread Steve Bertrand
On 2010.06.28 20:39, jimston...@aol.com wrote: > > In a message dated 6/28/2010 7:49:47 P.M. Eastern Daylight Time, > jwkr...@shaw.ca writes: > > jimston...@aol.com wrote: >> >> can anyone give me some help on a perl program to change a file of mine. >> The string is: >> >> $_ = "from ''ala

Re: No paths in Test-Harness-3.21.tar

2010-06-21 Thread Steve Bertrand
On 2010.06.21 18:22, Bob McConnell wrote: > After a little more digging, and trying your suggestion to try from > Linux, I have determined that the directory information in the new tar > files is being put into the prefix field of the header. But apparently > the older versions of tar (and WinZIP)

Re: Problems constructing a hash of hashes

2010-06-16 Thread Steve Bertrand
On 2010.06.16 19:36, Uri Guttman wrote: >> "CO" == Chas Owens writes: > CO> Or the online versions: > as a perl teacher i respect says, use the local docs as they are always > there ...point well taken. I will personally follow this method from now on. If any poster doesn't initially und

Re: Multi page form - cgi

2010-06-16 Thread Steve Bertrand
On 2010.06.16 07:12, Shlomi Fish wrote: > On Wednesday 16 Jun 2010 01:58:19 Herb wrote: >> My goal is to create a form that has multiple pages with a few >> questions per page so that visitors aren’t dropped into a large single >> page form that they feel is too daunting and therefore don’t fill i

Re: A subroutine to find every occurrence of a substring in a string?

2010-06-10 Thread Steve Bertrand
On 2010.06.10 05:07, Chas. Owens wrote: > On Thu, Jun 10, 2010 at 00:59, C.DeRykus wrote: > snip >> Not that I know of but you write your own subroutine >> using the index code you've shown. Nearly trivial to >> do and, after all, plagiarism is a virtue :) > snip > > I know that this was meant as

A story

2010-05-27 Thread Steve Bertrand
I once had a sub, taking a single param, kept passing it in until I was damned. All of a sudden, the sub needed two, I knew right then, that I was through. The undef was nice, naughty with spice, but the hrefs as params was what I should do. If you think a sub, will only accept one, accept param

Developer docs

2010-05-27 Thread Steve Bertrand
My ISP:: project has reached a level that it's almost unmaintainable by one person anymore. 49k+ lines of code across +15 modules, not including other custom modules that it has its hooks into. I once again am looking for advice on documentation practices. This project is beyond the point of havin

Re: How to get environment variables from child shell

2010-05-27 Thread Steve Bertrand
On 2010.05.27 20:15, Marilyn Sander wrote: > > On May 27, 2010, at 4:58 PM, Jim Gibson wrote: > >> On 5/27/10 Thu May 27, 2010 4:51 PM, "Bob Sadri" >> scribbled: >> >>> Hi >>> I have a perl script that calls a csh script. The csh script sources some >>> environment variables (among others).

Re: maping a network with perl

2010-05-19 Thread Steve Bertrand
On 2010.05.19 20:59, Steve Bertrand wrote: > On 2010.05.19 15:05, Bob McConnell wrote: >> From: Brian >> >>> On May 19, 2010, at 1:19 PM, packet wrote: >>> >>>> How can we map a network in perl? >>>> >>>> i was just thinking how

Re: maping a network with perl

2010-05-19 Thread Steve Bertrand
On 2010.05.19 15:05, Bob McConnell wrote: > From: Brian > >> On May 19, 2010, at 1:19 PM, packet wrote: >> >>> How can we map a network in perl? >>> >>> i was just thinking how we can do that.Sorry new to perl. >> Only way I know how to do it is with the use of Net::SNMP and >> Net::Ping. Use Net

Re: Need help with writing recursive menu in Perl.

2010-05-18 Thread Steve Bertrand
On 2010.05.17 21:44, Chetan wrote: > Dear Perl Experts, > > I need a big favor & help for me to learn perl programming, > I need to write menu to display (say Alpha, Beta, Gema) & store in > variable var1, based on which option is selected, I need to display > values in the next menu (if Alpha is

Re: data dumper

2010-05-17 Thread Steve Bertrand
On 2010.05.18 00:58, Uri Guttman wrote: > SB> Perhaps I completely missed something within the latter posts to this > SB> thread, so I must ask... > > SB> ...why not: > > SB> use Storable; > > SB> ...to store temporary data? I understood what Uri said, but does > SB> Storable not co

Re: data dumper

2010-05-17 Thread Steve Bertrand
On 2010.05.17 00:12, Shawn H Corey wrote: > On 10-05-16 11:17 PM, Uri Guttman wrote: >> it can be used to save data (e.g. a config >> file) in a file for reloading in the future (via running the dumper >> output with eval). > > By saving the output of Data::Dumper to a *.pm file, it can be reloade

Re: Using # instead of / as REGEX search delimiter

2010-05-10 Thread Steve Bertrand
On 2010.05.10 11:25, Vimal Kumar wrote: > Hi all, > > I am relatively new to Perl. Was learning references and thought of creating > a script that will list the username and its list of domains from httpd.conf > (on a cpanel server). I am curious to know why line > > if (/DocumentRoot \/home\/(\S

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Steve Bertrand
On 2010.05.07 21:09, Harry Putnam wrote: > "Uri Guttman" writes: > >> i haven't looked at the previous code but why is that being cleared here >> and pushed above? i don't get the purpose of the mod counter either. it >> just seems very odd but maybe there is a purpose. i won't delve to find >> o

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Steve Bertrand
On 2010.05.07 19:37, Steve Bertrand wrote: > (fwiw, and I don't have time to get into the rest of the code right now, > I prefer whitespace, so I'd write that as): > > my @ar1 = qw ( > r2one > r2two > r2three # comment,

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Steve Bertrand
On 2010.05.07 19:58, Uri Guttman wrote: >>>>>> "SB" == Steve Bertrand writes: > SB> (fwiw, and I don't have time to get into the rest of the code right now, > SB> I prefer whitespace, so I'd write that as): > > SB> my @ar1 = qw (

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Steve Bertrand
On 2010.05.07 19:37, Steve Bertrand wrote: > On 2010.05.07 19:02, Harry Putnam wrote: > >> It looks pretty awkward, the way I just kind of wedged the default >> action in there... is there a more canonical way of doing that? > > I have to be honest ;) > > There

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Steve Bertrand
On 2010.05.07 19:02, Harry Putnam wrote: > It looks pretty awkward, the way I just kind of wedged the default > action in there... is there a more canonical way of doing that? I have to be honest ;) There was a time a little while back that I decided that I would try hard not to troubleshoot cod

Re: how to denote the like symbol % in perl program

2010-05-04 Thread Steve Bertrand
On 2010.05.04 12:11, Pam Wampler wrote: > Here's the code -- I'm just learning perl so any help is greatly > appreciated > > It will work if I have the user input something like pam% with the > percent sign...but I really just want the user to have to enter pam and > have the program append the %p

Re: how to denote the like symbol % in perl program

2010-05-04 Thread Steve Bertrand
On 2010.05.04 11:21, Pam Wampler wrote: > How do you add the % sign in a perl program, if you are doing an oracle > query in the program? > > Example select date, name from my_table where name like upper(?)% > > > > The question mark would allow the user to enter the name - and I need to

Re: Dispatch table using Tie::RegexpHash

2010-04-29 Thread Steve Bertrand
On 2010.04.29 23:23, Uri Guttman wrote: >>>>>> "SB" == Steve Bertrand writes: > > SB> use Tie::RegexpHash; > > SB> my $number = qr/^\d+$/; > SB> my $alpha = qr/^\w+$/; > > SB> tie my %dt, 'Tie::RegexpHash'; >

Dispatch table using Tie::RegexpHash

2010-04-29 Thread Steve Bertrand
Hi all, Given the threads on dispatch tables recently, I was writing a bit of a whitepaper on how dts are useful for consolidating code. I've run into an issue that I've been working on for some time (while also performing my job function ;), and I'm hoping that extra eyeballs will notice the pro

Re: about dispatch tables

2010-04-29 Thread Steve Bertrand
On 2010.04.28 22:04, Harry Putnam wrote: > Your reference to `call back' is probably just the ticket... but I > will show actual code that tries to do what I need, and maybe you can > show how a `call back would work. This is pretty simple and has no inherent complexity whatsoever, but hopefully

Re: about dispatch tables

2010-04-28 Thread Steve Bertrand
On 2010.04.26 15:24, Harry Putnam wrote: > I hope some of you will go along with this approach. > > I want to try to describe briefly what problem I'm having. > But not show any working code. > > I've made so much of a mess trying a lot of different things I'd like > to have some idea that at lea

Re: about dispatch tables

2010-04-27 Thread Steve Bertrand
On 2010.04.26 15:24, Harry Putnam wrote: > I hope some of you will go along with this approach. > > I want to try to describe briefly what problem I'm having. > But not show any working code. > > I've made so much of a mess trying a lot of different things I'd like > to have some idea that at lea

Re: about dispatch tables

2010-04-27 Thread Steve Bertrand
On 2010.04.26 15:24, Harry Putnam wrote: > I want to try to describe briefly what problem I'm having. > But not show any working code. That's ok, but it isn't clear to me that you have really described a problem that you are stuck on. > I guess where I get stuck is how to make a dispatch table w

Re: ExtUtils::MakeMaker, execute Perl code during "make test"

2010-04-16 Thread Steve Bertrand
On 2010.04.16 11:32, Philip Potter wrote: > On 16 April 2010 14:38, Steve Bertrand wrote: >> This particular test: > It sounds like your test isn't a test, it's a setup tool. Tests in > projdir/t are there to test if the stuff in projdir/lib or > projdir/blib works

Re: ExtUtils::MakeMaker, execute Perl code during "make test"

2010-04-16 Thread Steve Bertrand
On 2010.04.16 09:15, Philip Potter wrote: > On 16 April 2010 13:20, Steve Bertrand wrote: >> I use prove often, usually when I want to quickly and non-verbosely (-Q) >> work with a single test file that I'm currently adding new tests to, or >> to ensure existing tests st

Re: ExtUtils::MakeMaker, execute Perl code during "make test"

2010-04-16 Thread Steve Bertrand
On 2010.04.16 03:36, Philip Potter wrote: > On 16 April 2010 02:05, Steve Bertrand wrote: >> On 2010.04.15 18:50, Steve Bertrand wrote: >> What I've done to 'rectify' the issue so that it is clear that the >> config files differ, is rename the test to the h

Re: how to create a hash on the fly

2010-04-15 Thread Steve Bertrand
On 2010.04.15 22:52, raphael() wrote: > It always comes down to desire and will to do something. yep. It also comes down to whether you (or your job function) meet the need or want. Personally, I find that learning comes from want, not need though. > I agree that had I mastered references most o

Re: how to create a hash on the fly

2010-04-15 Thread Steve Bertrand
On 2010.04.15 03:37, raphael() wrote: > On Thu, Apr 15, 2010 at 10:55 AM, Uri Guttman wrote: > >>> "r" == raphael() writes: >> >> r> # abc <-- this_should_be_hash_name >> the proper solution is to use a hash to hold these hashes. this is >> cleaner, safer, allows you to isolate this

Re: ExtUtils::MakeMaker, execute Perl code during "make test"

2010-04-15 Thread Steve Bertrand
On 2010.04.15 18:50, Steve Bertrand wrote: > Hi all, > > In one of my projects, I've written a test file t/22-upgrade.t. [..snip..] > However, when I run "make test", the Perl code for print does not execute. Replying my own post, this project is currently only u

ExtUtils::MakeMaker, execute Perl code during "make test"

2010-04-15 Thread Steve Bertrand
Hi all, In one of my projects, I've written a test file t/22-upgrade.t. I have a test within this file that looks for an existing installation, checks the versions, and compares the configuration files An upgrade does not overwrite the existing config, instead printing out a warning with a list

Re: Nested if and elsif and else

2010-04-14 Thread Steve Bertrand
On 2010.04.13 23:17, Kenneth Wolcott wrote: > Hi; > > On Tue, Apr 13, 2010 at 19:54, Uri Guttman wrote: >>> "JG" == Jim Gibson writes: >> >> JG> On 4/13/10 Tue Apr 13, 2010 4:35 PM, "Mimi Cafe" >> >> JG> scribbled: >> >> >> I think this will work, but is it elegant.? >> >> JG> Yes, i

Re: Copy file from one server to another

2010-04-14 Thread Steve Bertrand
On 2010.04.13 02:46, Chris Coggins wrote: > I need to copy a small config file from one server to another. I'm > generating the file on one server with a pretty complex script. I need > to put that file on another server for immediate user access via html. > I've tried just writing the file straigh

Re: Using References in Modules within threads

2010-04-07 Thread Steve Bertrand
On 2010.04.07 19:19, Rene Schickbauer wrote: > Shawn H Corey wrote: >> Rene Schickbauer wrote: >>> Shawn H Corey wrote: >>> Personally, I don't see why anyone would want to run Windows. It's like trying to run a marathon while dragging a bus. >>> >>> For me, its mainly because it pays th

Re: Getting a subroutine reference from an object instance

2010-04-07 Thread Steve Bertrand
On 2010.04.07 16:39, Shlomi Fish wrote: > On Wednesday 07 Apr 2010 19:23:25 Eric Veith1 wrote: >> Hello Perlers, >> >> this is probably going to be quick one. I know how to get an subroutine >> reference under "normal" circumstances, but I don't know how to get one >> from an object instance. Like:

Re: Storing a Hash Inside An Array

2010-03-26 Thread Steve Bertrand
On 2010.03.26 09:55, Pry, Jeffrey wrote: > Actually that hash error was a mistake on my part. > > My question is, if I push 3 records to @settings, how do I get, let's say, > just the second record? my $hashref = $settings[1]; This is why using a straight hash is easier. You can extract inform

Re: Storing a Hash Inside An Array

2010-03-26 Thread Steve Bertrand
On 2010.03.26 09:02, Pry, Jeffrey wrote: > I want to use the array because I have multiple ftp servers that can be > called from a dropdown box. Is it possible to do this with just a hash? It is possible: #!/usr/bin/perl use strict; use warnings; my %config; # each server info is a hash refer

Re: Storing a Hash Inside An Array

2010-03-26 Thread Steve Bertrand
On 2010.03.26 08:36, Pry, Jeffrey wrote: > Hey, > > First off let me say that this mailing list is great! It is nice to be able > to see the collaborative effort that everyone puts in when one of us has a > question or issue. Thank you! > > Now, I was wondering if it would be possible to store

Re: Object Oriented

2010-03-24 Thread Steve Bertrand
On 2010.03.24 08:09, Pry, Jeffrey wrote: > Hey, > > Does anyone know of good resource to learn object oriented Perl? Also, can > Perl be considered truly object oriented? perldoc perlobj Also, quite a few years ago, I found "Learning Perl Ojbects, References and Modules" by Randal Schwartz to b

Re: assign s/// value to a scalar

2010-03-11 Thread Steve Bertrand
On 2010.03.12 00:33, John W. Krahn wrote: > raphael() wrote: >> #!/usr/bin/env perl >> >> use strict; >> use warnings; >> >> my @array = qw ( >> http://abc.com/files/randomthings/A/1.html >> http://abc.com/files/randomthings/A/2.html >> ); >> >> for ( @array ) { >> >> # This works >> # s!/A/\d+

Writing tests for module utility scripts

2010-03-10 Thread Steve Bertrand
Hi all, I've got a module that has a significant number of unit tests for each sub, each within its own file: acct-dev: ISP-RADIUS % ls t | grep daily 07-aggregate_daily.t Within the overall package, I've included a few utility scripts that are installed into the OS path that utilize these subs.

Fwd: Re: question on software development

2010-03-04 Thread Steve Bertrand
On 2010.03.04 21:34, ANJAN PURKAYASTHA wrote: > Are you joking? This was supposed to be a serious question. I'll answer it again: - right-click on your desktop - click 'create shortcut' - click 'Browse' - locate the installation package that contains your program from within your network - click

Re: question on software development

2010-03-04 Thread Steve Bertrand
On 2010.03.04 20:04, ANJAN PURKAYASTHA wrote: > OK, suppose I develop a Perl application. I want to create an icon for the > program so that a user may download the program and start it in the GUI by > double-clicking on the icon. > How does one go about doing it? Research Associate at Harvard Uni

Re: Shorthand for binary bitwise math?

2010-02-22 Thread Steve Bertrand
On 2010.02.22 17:44, Uri Guttman wrote: >> "1" == 120 writes: > > >> "off list", as I don't like to clog everyone's email with my thank > >> you note. > >> > 1> It's generally considered very rude - but the world is full of rude > 1> arseholes. Many of them can be found on the per

Re: sequential value check

2010-02-09 Thread Steve Bertrand
Curt Shaffer wrote: >> >> >> Uri> post the output line from that command. do not let your emailer mung it >> or word wrap it. show the part you want to extract out. there may be >> easier ways to get it with a regex and not with split. > > I think you may be right. I would like to pull the numeric

Re: sequential value check

2010-02-09 Thread Steve Bertrand
Uri Guttman wrote: > CS> foreach (@hping_array){ > > foreach my $ping ( @hping_array){ Uri showed right above how to avoid using $_. eg instead of: foreach ( @hping_array ) { $_ + 10; #...60 lines of code print "$_\n"; } do: for my $ping_result ( @hping_array ) {

Re: sequential value check

2010-02-09 Thread Steve Bertrand
Steve Bertrand wrote: > Curt Shaffer wrote: >> #!/usr/bin/perl >> use warnings; >> use strict; >> my $hping; >> my $hping_compare; >> my @hping_array = (); >> >> >> for (1 .. 5){ >> >> $hping = `sudo hping3 www.microso

Re: sequential value check

2010-02-09 Thread Steve Bertrand
Curt Shaffer wrote: > #!/usr/bin/perl > use warnings; > use strict; > my $hping; > my $hping_compare; > my @hping_array = (); > > > for (1 .. 5){ > > $hping = `sudo hping3 www.microsoft.com -S -p 80 -c 1`; > push @hping_array,(split'\ ',$hping)[15]; > } > $hping_compare = $hping_

Re: AW: Warning: Use of uninitialized value

2010-01-29 Thread Steve Bertrand
Thomas Bätzler wrote: > Bob Williams asked: >> I am trying to split the lines in a file into two halves (at the first >> space) each half going into an array. The code I have written is below. > >> ---Code--- >> #!/usr/bin/perl >> use warnings; >> #use strict; > > use strict; # unless you know w

Re: Geeky way to wish Happy Birthday through Perl

2010-01-19 Thread Steve Bertrand
Parag Kalra wrote: > Here it comes - > > perl -e "BEGIN{print 'Birthday '} UNITCHECK{print 'Sweets '} CHECK{print > '@ '} INIT{print 'my '} END{print 'Desk'}" > > Message is different but intention is same - Nasty & Nerdy :) > > Also it works only on Windows :( ...are you sure? On FreeBSD: % p

Re: Geeky way to wish Happy Birthday through Perl

2010-01-19 Thread Steve Bertrand
Randal L. Schwartz wrote: >>>>>> "Steve" == Steve Bertrand writes: > > Steve> Parag Kalra wrote: >>> Yes I found one really nerdy and nasty JAPH. :) > > Steve> ...ensure that you credit the original author, out of respect, if > Steve>

Re: Geeky way to wish Happy Birthday through Perl

2010-01-19 Thread Steve Bertrand
Parag Kalra wrote: > Yes I found one really nerdy and nasty JAPH. :) ...ensure that you credit the original author, out of respect, if anything ;) Steve -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: How to make skip an input parameter.

2010-01-11 Thread Steve Bertrand
Parag Kalra wrote: > use strict; > use warnings; The above should *always* be present in *every* Perl script, even when you think you are writing a script to test something only once. > use Getopt::Long; > > my ( $name, $passion, $age); > > my $result = GetOptions( >'name|n=s'

Re: How to make skip an input parameter.

2010-01-11 Thread Steve Bertrand
Owen wrote: >> Hello All, >> >> This is surely a beginner's question and may even sound silly. :) >> >> How do you make a Perl script skip an input parameter if it is not >> present. >> Let me explain it through an example. >> >> EG: >> #!/usr/bin/perl >> use strict; >> use warnings; >> no warnings

Re: Please help to load script from secure server HTTPS in Safari and Opera

2010-01-04 Thread Steve Bertrand
Jeremiah Foster wrote: > On Jan 5, 2010, at 1:03, Steve Bertrand wrote: > >> Jeremiah Foster wrote: >>> On Jan 4, 2010, at 11:49, Simphiwe Mkhize wrote: >>> >>>> Good new year >>>> >>>> Can any one please help me to solve pr

Re: Please help to load script from secure server HTTPS in Safari and Opera

2010-01-04 Thread Steve Bertrand
Jeremiah Foster wrote: > On Jan 4, 2010, at 11:49, Simphiwe Mkhize wrote: > >> Good new year >> >> Can any one please help me to solve problem with Safari, Google Chrome and >> Opera. my script has to load from secure server HTTPS for security reason. >> It works fine from IE and Firefox. >>

Understanding the definition of 'short-circuiting'

2009-12-29 Thread Steve Bertrand
Happy holidays everyone! I've found Devel::Cover to be an exceptionally handy item, but don't think I entirely grasp what the term 'short-circuiting' actually means. I hope this is a beginner-type question for beginners who are writing tests ;) My code (snip, for context): if ( ! $self->IN_TEST

Re: Perlcritic complains about assignment within conditional

2009-12-17 Thread Steve Bertrand
Peter Scott wrote: > Although it turned out not to be what was going on here, just to address > your subject line' it's not just Perlcritic that will complain about > assignment in a conditional, but also warnings: > > % perl -wle 'print 42 if $x = 0' > Found = in conditional, should be == at -e

Re: Perlcritic complains about assignment within conditional

2009-12-15 Thread Steve Bertrand
Steve Bertrand wrote: > John W. Krahn wrote: >> perldoc perlsyn >> [ SNIP ] >> NOTE: The behaviour of a "my" statement modified with a statement >> modifier conditional or loop construct (e.g. "my $x if ...") is >> undefined

  1   2   3   4   >