On Fri, 2006-16-06 at 12:15 +0200, Paul Johnson wrote:
> On Tue, Jun 13, 2006 at 12:06:02PM -0700, Lawrence Statton wrote:
>
> > Charles Clarkson wrote:
> > > @{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs;
> >
> > You can excise a little of the snyactic sugar there
> >
> > @$hash_ref{
Beginner wrote:
> On 16 Jun 2006 at 12:15, Paul Johnson wrote:
>
>>On Tue, Jun 13, 2006 at 12:06:02PM -0700, Lawrence Statton wrote:
>>
>>>Charles Clarkson wrote:
@{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs;
>>>You can excise a little of the snyactic sugar there
>>>
>>>@$hash_ref{
On 16 Jun 2006 at 12:15, Paul Johnson wrote:
> On Tue, Jun 13, 2006 at 12:06:02PM -0700, Lawrence Statton wrote:
>
> > Charles Clarkson wrote:
> > > @{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs;
> >
> > You can excise a little of the snyactic sugar there
> >
> > @$hash_ref{keys %kv_
On Tue, Jun 13, 2006 at 12:06:02PM -0700, Lawrence Statton wrote:
> Charles Clarkson wrote:
> > @{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs;
>
> You can excise a little of the snyactic sugar there
>
> @$hash_ref{keys %kv_pairs} = values %kv_pairs;
%hash = (%hash, %kv_pairs);
hmmm,
Charles Clarkson wrote:
> @{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs;
You can excise a little of the snyactic sugar there
@$hash_ref{keys %kv_pairs} = values %kv_pairs;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - [EMAIL PROTECTED] s
Mr. Shawn H. Corey wrote:
: for ( keys %kv_pairs ){
: $hash_ref->{$_} = $kv_pairs{$_};
: }
You could use a hash slice there.
@{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs;
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer
254 968-
On Tue, 2006-13-06 at 13:08 -0400, Mr. Shawn H. Corey wrote:
> $times{$hashkey}{home} = $time;
> $times{hashkey}{total} = $total;
>
> # Your code replaces, not augments
Consider adding this to your library of useful Perl utilities:
# --
# hset %hash, ( $ke
On Tue, 2006-13-06 at 17:20 +0100, [EMAIL PROTECTED] wrote:
> Hi,
>
> This is a bit of an extension on an earlier post.
>
> I am trying to create a data structure from a file (contents below). It is
> meant to be a hash of
> hashes but I suspect there is either a typo somewhere or I am hitting
On 13 Jun 2006 at 12:27, Mr. Shawn H. Corey wrote:
> On Tue, 2006-13-06 at 17:20 +0100, [EMAIL PROTECTED] wrote: >
> print STDERR Dumper(%times);
>
> print STDERR Dumper( \%times );
That seems to have helped the Dumper output but I still haven't
managed to get the other assignments to stick.
On Tue, 2006-13-06 at 17:20 +0100, [EMAIL PROTECTED] wrote:
> print STDERR Dumper(%times);
print STDERR Dumper( \%times );
--
__END__
Just my 0.0002 million dollars worth,
--- Shawn
"For the things we have to learn before we can do them, we learn by doing them."
Aristotle
* Perl t
On Thu, Sep 19, 2002 at 09:39:54AM +0100, Gary Stainburn wrote:
> I've got a problem understanding a scoping issue I've got.
http://perl.plover.com/FAQs/Namespaces.html is a good online resource for
learning about scoping.
> I've got 2 hashes which I defined inside the sub that generates the f
Gary Stainburn wrote:
> Hi all,
>
> I've got a problem understanding a scoping issue I've got.
>
> I've got 2 hashes which I defined inside the sub that generates the form
> thus:
>
> sub do_form() {
> my ($error)=@_;
> my %dships=('X'=>'','L'=>'Leeds','D'=>'Doncaster');
> my %depts=('X'
--On Montag, 25. Februar 2002 10:24 -0900 Michael Fowler
<[EMAIL PROTECTED]> wrote:
> On Mon, Feb 25, 2002 at 07:45:30PM +0100, Birgit Kellner wrote:
>> for (@array) { # contains a bunch of numbers
>> my %hash = &get_record($_);
>> }
> Are you under the mistaken impression that 'for' is no
--On Montag, 25. Februar 2002 10:24 -0900 Michael Fowler
<[EMAIL PROTECTED]> wrote:
> On Mon, Feb 25, 2002 at 07:45:30PM +0100, Birgit Kellner wrote:
>> for (@array) { # contains a bunch of numbers
>> my %hash = &get_record($_);
>> }
> Are you under the mistaken impression that 'for' is no
> Small question: I thought when doing a for loop over an array, I can simply
> do this:
> for (@array) { # do stuff with $_ }
for my $ele (@array) { # stuff with $ele }
In 99.99% of the perl programs you write you'll use my instead of local.
In fact, if you think you need to use local with a va
On Mon, Feb 25, 2002 at 07:45:30PM +0100, Birgit Kellner wrote:
> for (@array) { # contains a bunch of numbers
> my %hash = &get_record($_);
> }
> foreach (@array) { print "$_\n";\ # problem - $_ is not the array element anymore
It isn't?
$\ = "\n";
my @array = qw(foo bar baz qux);
At 07:45 PM 2/25/02 +0100, Birgit Kellner wrote:
>Small question: I thought when doing a for loop over an array, I can
>simply do this:
>for (@array) { # do stuff with $_ }
>
>Now I have this situation:
>
>for (@array) { # contains a bunch of numbers
> my %hash = &get_record($_);
>}
>fore
On Mon, Feb 25, 2002 at 07:45:30PM +0100, Birgit Kellner wrote:
> Small question: I thought when doing a for loop over an array, I can simply
> do this:
> for (@array) { # do stuff with $_ }
>
> Now I have this situation:
>
> for (@array) { # contains a bunch of numbers
> my %hash = &get_
Yeah, for normal variables, you can declare them "local", but I'm not sure
you can do that with $_. Try it by adding "local($_);" to the first line of
your subroutine. Otherwise, it will get overwritten, and you may have to
declare a variable to do what you want to do.
Justin
-Original Mes
19 matches
Mail list logo