Re: Passing arrays/associative arrays into subroutines ... how?

2003-06-02 Thread Ken Tozier
On Sunday, June 1, 2003, at 04:35 PM, James Edward Gray II wrote: On Sunday, June 1, 2003, at 03:27 PM, Ken Tozier wrote: my $description = DescribeCritter(\%wombatStats); This is passing a hash to a hash. No reference required for that. Just drop the \. I also believe you have a space after

Passing arrays/associative arrays into subroutines ... how?

2003-06-02 Thread Ken Tozier
Here's the flip side of yesterday's array question. Now that I know how to pass associative arrays out of a routine, I'm having trouble trying to use them in other routines. The best I can figure from reading is that I need to pass them by reference, but in practice, the terminal always fills u

Re: Returning arrays from subroutines... how?

2003-06-02 Thread Ken Tozier
Thanks for answering David, Jeff and Beau. My script works like a charm now. Ken -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Returning arrays from subroutines... how?

2003-06-01 Thread Ken Tozier
I'm sure this is an easy one but after Googling for hours, I still don't get it. Given the following subroutine, how do I return the result array? Nothing I try works. sub GetMarmots { @result = (); $result{'steppe marmot '} = 4; $result{'himalayan marmot'} = 3; $

Re: Splicing sub input into a regular expression

2003-05-31 Thread Ken Tozier
That did the trick. Thanks, Ken On Friday, May 30, 2003, at 07:19 PM, James Edward Gray II wrote: On Friday, May 30, 2003, at 06:10 PM, Ken Tozier wrote: sub GetPhotoInfo($inPhotoPath) This should be: sub GetPhotoInfo { open(PROPS, 'egrep -a \']+)>[^<]*\' $inPhotoP

Splicing sub input into a regular expression

2003-05-31 Thread Ken Tozier
I just put the finishing touches on some Perl code that reads info from Photoshop jpeg files but when trying to package it up inside a subroutine, I'm having trouble using the input variable. For example in the naked code I wrote: open(PROPS, 'egrep -a \']+)>[^<]*\' "file.jpg" | '); but when t

RE: Newbie not getting expected values from s/// operator

2003-05-31 Thread Ken Tozier
On Friday, May 30, 2003, at 08:24 AM, Kipp, James wrote: Next I try to loop through the results and extract parts of each string like so: $tmp = ""; while () { $tmp .= s/]+)>([^<]*)/$1: $2/; } Doing a "print" on $tmp, yeilds 1 None of the lines in "PROPS" contain a single dig

Re: Newbie not getting expected values from s/// operator

2003-05-30 Thread Ken Tozier
That did the trick, Thanks. Ken On Friday, May 30, 2003, at 04:26 AM, Halkyard, Jim wrote: Without testing or really investigating this I'd say you're getting the 'exit status' of the s/// operation. As you've written it the substitution is working on $_ and you're appending the return value to

Newbie not getting expected values from s/// operator

2003-05-30 Thread Ken Tozier
I wrote a simple script to extract some of the info Photoshop 6 embeds in jpeg files through the "file info" dialog box and find that I can extract the info no problem with: open(PROPS, 'egrep -a \']+)>[^<]*\' "botanical-garden12-full.jpg" | '); Doing print ; shows that the info I'm looking fo