When to use anonymous references

2010-04-26 Thread Tim Bowden
y informal criteria tends to be to use an anonymous ref from the start if I'm going to be passing it to a sub, and a named array or hash otherwise. I've found the former to be much more common. Thoughts? Regards, Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For ad

Re: references to operators?

2010-04-16 Thread Tim Bowden
On Fri, 2010-04-16 at 12:51 +0300, Shlomi Fish wrote: > Hi Tim, > > On Friday 16 Apr 2010 12:06:31 Tim Bowden wrote: > > I've got a nested hash data structure, and I want to create tests for > > many of the attributes within that data structure, but I'm not sure

Re: how to create a hash on the fly

2010-04-16 Thread Tim Bowden
On Fri, 2010-04-16 at 08:40 +0100, Philip Potter wrote: > > Great post, Steve. Does perl-beginners have a website where this could > be archived for later reference? > > Phil > http://www.nntp.perl.org/group/perl.beginners/ Tim Bowden -- To unsubscribe, e-mail:

references to operators?

2010-04-16 Thread Tim Bowden
could create a generic if statement, and put the tests within the data structure by adding something like: 'test_operator' => '=', 'test_value' => 'somevalue' at the 'attrib' level of the data structure. Then the if statement would look something like.. if ($refToAttrib $refToOperator $refToTestValue){... The $refToOperator is the problem bit. Can that be done, or is there a better way to solve the problem? Thanks, Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Perl Questions

2009-10-05 Thread Tim Bowden
On Mon, 2009-10-05 at 09:20 +0200, Shlomi Fish wrote: > On Monday 05 Oct 2009 07:01:47 Tim Bowden wrote: > > On Sun, 2009-10-04 at 15:03 -0700, Slick wrote: > > > I have a couple of questions. > > > > > > What is a good starter perl book to learn perl. > >

Re: Perl Questions

2009-10-04 Thread Tim Bowden
ning) No idea how much Perl is used in Windows admin, but I'd hate to admin a nix box without any Perl skills. > > Jason H. Owens > Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Burnt Camel Club

2009-09-23 Thread Tim Bowden
week small coding challenge (posted by 'those that know'?) that should take no more than 5-10 mins covering 'Programming 101 in Perl' type material (ie, no deep magic!). Brownie points for any decent/reasonable solution posted by a beginner within 24 hours. Rotten eggs for th

Re: regex question

2009-09-15 Thread Tim Bowden
t; Ah, so you do want to anchor at the beginning and end of the string. Have you looked at perlrequick (http://perldoc.perl.org/perlrequick.html) as Uri suggested? That should show you how to anchor a regex to the start and end of a string. Post what you're trying after looking there. Re

Re: regex question

2009-09-15 Thread Tim Bowden
ave googled and found code that will find 3 consecutive digits > within a string or at the beginning. > > Any ideas ? > Thanks > G > So you want a regex that will identify a three digit string (any 3 digits or 3 specified digits?) and anchor to both the start and end of the strin

Re: Giving away my code

2009-09-14 Thread Tim Bowden
ference to the license file. If you really are putting the code in the public domain, a short statement saying so should suffice (in which case you can't add license terms or claim copyright). > > Steve Not giving legal advice and most certainly not an expert, Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Ternary operator

2009-09-14 Thread Tim Bowden
undertake the task? Or has it been put on the backburner for Perl6? I suspect there is a significant level of latent demand for an update after so many years and Perl versions. Regards in anticipation of an eventual update, Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...

Re: beginner projects

2009-09-07 Thread Tim Bowden
I've an itch I'm scratching atm (initially driven by work requirements) that I'd like to see made publicly available eventually (binary file converter; flexln/powerflex), so I'd probably want to get that sorted first, but then this would be very tempting indeed. In trepidati

Re: Regexps handle only the first number

2009-09-07 Thread Tim Bowden
the only one who learned something here. I hadn't thought of evaluating regexs in list context (says me wondering how many times I've done $a = $1; $b = $2;...) Great stuff. Not sure if the list is a supplement to the books (Learning Perl etc) or the books a supplement to the list. Both good. Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Fwd: Perl projects for beginners

2009-09-07 Thread Tim Bowden
dly, is > what to do once those beginners start arriving. > > > -- > Erez All true imho & limited experience. How many projects try and take advantage of GSOC? It's a big undertaking for a project, but I don't think making a project newbie friendly is any less of an undertaking. Regards, Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Perl projects for beginners

2009-09-07 Thread Tim Bowden
rial covered, but I get sidetracked by scratching my own itch. Those bits I need I tend to write my own 'exercises' till I understand the feature in question. Still, I suppose they do help some people. Again, each to their own. I'm wondering if your really targeting newbies, or rather intermediates that are 'newbies to a project'? I don't think they're the same. Regards, Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Perl's superior text parsing power

2009-09-02 Thread Tim Bowden
p applications then I can see the attraction of Perl. I know there are also plenty of Perl 'massive complex' apps out there, but that doesn't seem to be the norm. [1] I'd also put binary data in there, but it doesn't seem to get as much attention. Regards, Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: accessing chars in a string

2009-09-01 Thread Tim Bowden
#x27; equivalent), and end up looking like an 'X' type question by virtue of its form rather than its nature. Sometimes the OP just doesn't realise the more generic case of what they're trying to do, particularly if they're now to programming in general. If it's all n

Re: "Time issues"

2009-08-31 Thread Tim Bowden
gt; > thanks > Ajay The solution is to write more efficient code. Without seeing the code you're using, it's not possible to give you more specific advice. Regards, Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: regex patern matching script

2009-08-30 Thread Tim Bowden
On Mon, 2009-08-31 at 01:18 -0400, Uri Guttman wrote: > >>>>> "TB" == Tim Bowden writes: > > TB> On Sun, 2009-08-30 at 21:53 -0700, John W. Krahn wrote: > >> Tim Bowden wrote: > >> > I'm trying to extend (again) the short re

Re: regex patern matching script

2009-08-30 Thread Tim Bowden
On Sun, 2009-08-30 at 21:53 -0700, John W. Krahn wrote: > Tim Bowden wrote: > > I'm trying to extend (again) the short regex checking script given in > > Learning Perl (Absolutely fabulous book btw! Highly recommend it to > > anyone trying to learn Perl). I'd l

regex patern matching script

2009-08-30 Thread Tim Bowden
# print "next memory var:$_\n"; #} } else { print "No match :-(\n"; } } Given the regex is being provided as an arg to the script, it's not possible in advance to predict how many matched memories there will be. Thanks, Tim Bowden -- To unsubscribe

User input, & Ctrl-D

2009-08-28 Thread Tim Bowden
DIN became not true...\n"; - Ctrl-D only works for the first loop through. Any suggestions? Thanks, Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Need some explanation.

2009-08-27 Thread Tim Bowden
that the value passed becomes: '; drop table tablename; -- It's unlikely you'll have such a string stored in field x ;-) HTH Tim Bowden BTW, please don't top post. It ruins the flow of the conversation. > > > On Wed, Aug 26, 2009 at 4:37 PM, Chas. Owens w

Re: Taint mode & user supplied file names

2009-08-26 Thread Tim Bowden
On Wed, 2009-08-26 at 14:48 -0700, Mark Wagner wrote: > On Mon, Aug 24, 2009 at 06:06, Tim Bowden wrote: > > On Mon, 2009-08-24 at 14:46 +0200, Rob Coops wrote: > > > > >> In your case where you run the script from a command line you will still > >> want

Re: removing a 'tee'd file handles going forward

2009-08-26 Thread Tim Bowden
IO::Tee; my $tee; my $somecondition = 1; my $tee_all = new IO::Tee(\*STDOUT, \*STDERR); $tee = \*STDOUT; select $$tee; print "going to stdout only\n"; $$tee->flush; # select output fh at runtime if ($somecondition == 1){ $tee = \$tee_all; select $$tee; } print "this goes to all\n"; $$tee->flush; $tee = \*STDERR; select $$tee; print "this goes to stderr only\n"; $$tee->flush; Regards, Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Taint mode & user supplied file names

2009-08-24 Thread Tim Bowden
On Mon, 2009-08-24 at 14:46 +0200, Rob Coops wrote: > On Mon, Aug 24, 2009 at 2:17 PM, Tim Bowden wrote: > > > #!/usr/bin/perl -wT > > use strict; > > > > my $filename = shift @ARGV; > > > > if (-f $filename){ > > open OUT, "> $filename.ne

Taint mode & user supplied file names

2009-08-24 Thread Tim Bowden
e on all (or any) platforms? Are there any other checks I should be doing on the file name before untainting it? Thanks, Tim Bowden -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Trying to remove text in inverted commas.

2009-08-24 Thread Tim Bowden
g:\n$_\n\n"; } print "\nthird regex... (not so greedy)\n"; for my $log (@log_entries){ $_ = $log; s/".*?"//g; print "$log:\n$_\n\n"; } print "\nfourth regex... (and killing spaces leading the \"text\")\n"; for my $log (@log_entries){

Re: isolating text in a string

2008-06-26 Thread Tim Bowden
On Tue, 2008-06-24 at 19:37 -0700, John W. Krahn wrote: > Tim Bowden wrote: > > Hi, > > Hello, > > > I'm trying to isolate text in a string. My string is typically of the > > form: > > sometext["moretext", > > > > I would lik

isolating text in a string

2008-06-24 Thread Tim Bowden
(/$string/,\[,2); print "$snippet\n"; I don't seem to be able to escape the [ in the split function, so two questions: 1. How do I escape the [? 2. What would be a better way to approach this problem? Thanks, Tim Bowden -- To unsubscribe, e-mail: [EMAIL PROTECTED] For a

Re: scalar / hash problem in HTML::Parser

2008-02-25 Thread Tim Bowden
r->parse_file($file) or die "couldn't parse file"; ## end Thanks, Tim Bowden (fighting back against the stupid stick) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: scalar / hash problem in HTML::Parser

2008-02-25 Thread Tim Bowden
Thanks Chas, most useful. Regards, Tim Bowden On Mon, 2008-02-25 at 09:55 -0500, Chas. Owens wrote: > On Mon, Feb 25, 2008 at 9:01 AM, Tim Bowden <[EMAIL PROTECTED]> wrote: > > Making progress. Needed to understand hash references, and how to > > de-reference them. > sni

Re: scalar / hash problem in HTML::Parser

2008-02-25 Thread Tim Bowden
Making progress. Needed to understand hash references, and how to de-reference them. Tim Bowden On Mon, 2008-02-25 at 14:54 +0900, Tim Bowden wrote: > Hi all, > > I'm using HTML::Parser to process files containing snippets of html > looking like: > First optionAnother >

scalar / hash problem in HTML::Parser

2008-02-24 Thread Tim Bowden
ise it should be obvious and simple, but I feel like I've been hit with the stupid stick for now. Any suggestions? Thanks, Tim Bowden -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Extract attribute from huge xml file

2007-12-10 Thread Tim Bowden
On Mon, 2007-12-10 at 08:43 -0500, Chas. Owens wrote: > On Dec 10, 2007 8:24 AM, Tim Bowden <[EMAIL PROTECTED]> wrote: > > > > On Mon, 2007-12-10 at 13:14 +, Beginner wrote: > > > Hi, > > > > > > I have a huge XML file, 1.7GB, 53080215 lines

Re: Extract attribute from huge xml file

2007-12-10 Thread Tim Bowden
he memory on a > server. If your data file is on a *nix system, use head -200 filename > sample_filename to take the first 200 records. HTH, Tim Bowden -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: CGI meets Archive::Zip

2007-12-10 Thread Tim Bowden
On Mon, 2007-12-10 at 10:16 +0100, Gunnar Hjalmarsson wrote: > Tim Bowden wrote: > > I'm trying to write a small cgi app that takes an uploaded zip file, > > extracts the contents and does some operations on the included files. > > Following is a cut down version of my

CGI meets Archive::Zip

2007-12-09 Thread Tim Bowden
E, "> $working_dir/$upload_hash_ref->{'zip_file'}"; # Save the Zip file to disk unless ( $zip->writeToFileNamed("ZIPINSTANCE") == AZ_OK ) { die 'Here I lay, mortally struck'; } push (@results, "wrote zip file to disk"); print $upload->header

Re: cgi app runtime unique identifier.

2007-09-02 Thread Tim Bowden
Thanks all, I've now got enough info to solve the problem. Regards, Tim Bowden On Sat, 2007-09-01 at 09:34 -0700, Tom Phoenix wrote: > On 9/1/07, Tim Bowden <[EMAIL PROTECTED]> wrote: > > > I'm writing a small cgi app that takes an uploaded file, stores it on >

cgi app runtime unique identifier.

2007-09-01 Thread Tim Bowden
right direction here? It's not something I've done before and I don't want to go off half cocked with something that will lead to intermittent failure. There's no user login etc so no options there I can use. Thanks, Tim Bowden -- To unsubscribe, e-mail: [EMAIL PROTECTED] For ad