🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #7852

Re: Lastige structuren in Perl

#7852
From: Philip Paeps
Date: Wed, 24 Jul 2002 15:12
44 lines
2275 bytes
Philip Paeps <philip@paeps.cx> wrote:

[...]

> Ik haal een lijst programma's, en de uren waarop ze worden uitgezonden,
> gesplitst door komma's, uit mijn database met DBI.  

[...]

> Nu het probleem: ik zou deze data in een hash met uren als keys willen
> proppen ($today{'01:00'}[0] = "Kinderen!?! ...", $today{'08:00'}[0] =
> "Kinderen!?!  ...", enz) om dan makkelijk te kunnen sorteren, maar ik zie
> niet echt direct een effici�nte manier om die data in die hash te proppen.

[...]

Na wat prutsen eindelijk toch gevonden.  

Nog redelijk elegant ook.  Idioot dat ik er zo lang op zitten zoeken heb.

my %programmes;
my @ary;
	
while(@ary = $sth->fetchrow_array())
{
	my @times = split(/,/, $ary[1]);
	my $time;

	foreach $time (@times)
	{
		$programmes{$time}[0] = $ary[0];
	}
}

Hopelijk heb ik niemand hoofdpijn bezorgd :-P

 - Philip

-- 
Philip Paeps                                                   philip@paeps.cx

  When you're up to your ass in alligators, it is
  difficult to keep your mind on the fact that your primary
  objective was to drain the swamp.
Technical Details
Message-ID: <Atz%8.26713$8o4.3609@afrodite.telenet-ops.be>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-04!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!skynet.be!skynet.be!ossa.telenet-ops.be!afrodite.telenet-ops.be.POSTED!not-for-mail
References: <7j0%8.23892$8o4.3060@afrodite.telenet-ops.be>

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII
X-Google-Thread: fcea4,21f671378bd4e4e
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2002-07-24 08:17:03 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-04!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!skynet.be!skynet.be!ossa.telenet-ops.be!afrodite.telenet-ops.be.POSTED!not-for-mail
Sender: Philip Paeps <philip@juno.home.paeps.cx>
From: Philip Paeps <philip@paeps.cx>
Subject: Re: Lastige structuren in Perl
Newsgroups: be.comp.programming
References: <7j0%8.23892$8o4.3060@afrodite.telenet-ops.be>
User-Agent: tin/1.5.14-20020718 ("Chop Suey!") (UNIX) (FreeBSD/4.6-STABLE (i386))
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
Lines: 44
Message-ID: <Atz%8.26713$8o4.3609@afrodite.telenet-ops.be>
Date: Wed, 24 Jul 2002 15:12:32 GMT
NNTP-Posting-Host: 213.118.135.50
X-Complaints-To: abuse@telenet.be
X-Trace: afrodite.telenet-ops.be 1027523552 213.118.135.50 (Wed, 24 Jul 2002 17:12:32 MET DST)
NNTP-Posting-Date: Wed, 24 Jul 2002 17:12:32 MET DST
Organization: Telenet Internet