Article View: pl.comp.lang.perl
Article #39800Re: hash w hashu i jeszcze tablcia skalarów
From: Szymon Sokół
Date: Wed, 20 Oct 2004 21:16
Date: Wed, 20 Oct 2004 21:16
34 lines
2732 bytes
2732 bytes
Zbyszek Malec <zbyszekto@tlen.pl> wrote:
: Tadda!!! Szymon Sokół Tadda!!!
: > To właśnie oznacza, że $HoH{$login} zawiera referencję do hasha, w
: > którym pod kluczem 'uid' zapiszemy $uid.
: Czy to znaczy że poniższe dwa zapisy są jednoznaczne?
: $HoH{ $login }{ 'uid' } = $uid;
: $file_attachments{'test2.zip'}->{'price'};
Jednoznaczne i równoważne - znaczy, $hash{$index1}{$index2} to tylko
skrótowa notacja dla $hash{$index1}->{$index2} - analogicznie jest z
$array[$index1][$index2] i $array[$index1]->[$index2], a także z
konstrukcjami mieszanymi, tj. $array[$index1]{$index2} lub
$hash{$index1}[$index2]
: > I nie rozumiem, czemu chcesz zmieniać podejście.
: Do zapisania danych używam plików *dbm, które mogą przechowywać
: pojedynczego hasha. Myślałem że jak to sprytnie upakuję (a mam parę
: poziomów zagnieżdżeń :] ) to mi się uda to zrobić w pojedynczym pliku.
: Jeżeli jednak będę miał hasha z referencjami to nic mi to nie da, będę
: musiał zmienić formę zapisu, a ta którą mam obecnie jest raczej logiczna
: i spójna.
Obawiam się, że masz rację - tak się nie da. Możesz skorzystać z jakiegoś
modułu przewidzianego do przechowywania struktur w plikach (Storable?
Data::Dumper? Coś z tych rzeczy).
--
Szymon Sokół (SS316-RIPE) -- Network Manager B
Computer Center, AGH - University of Science and Technology, Cracow, Poland O
http://home.agh.edu.pl/szymon/ PGP key id: RSA: 0x2ABE016B, DSS: 0xF9289982 F
Free speech includes the right not to listen, if not interested -- Heinlein H
Technical Details
Message-ID:
<cl6kk9$qve$1@galaxy.uci.agh.edu.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!agh.edu.pl!news.agh.edu.pl!not-for-mailReferences:
<1098302099.409440@vax.ustronie.pw.edu.pl> <cl6h30$agm$1@galaxy.uci.agh.edu.pl> <1098304130.361688@vax.ustronie.pw.edu.pl> <cl6jad$klv$1@galaxy.uci.agh.edu.pl> <1098306421.174041@vax.ustronie.pw.edu.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!agh.edu.pl!news.agh.edu.pl!not-for-mail
From: Szymon Sokół
<szymon@bastard.operator.from.hell.pl>
Newsgroups: pl.comp.lang.perl
Subject: Re: hash w hashu i jeszcze tablcia skalarów
Date: Wed, 20 Oct 2004 21:16:57 +0000 (UTC)
Organization: University of Mining & Metallurgy
Lines: 34
Sender: Szymon Sokol <szymon@galaxy.uci.agh.edu.pl>
Message-ID: <cl6kk9$qve$1@galaxy.uci.agh.edu.pl>
References: <1098302099.409440@vax.ustronie.pw.edu.pl> <cl6h30$agm$1@galaxy.uci.agh.edu.pl> <1098304130.361688@vax.ustronie.pw.edu.pl> <cl6jad$klv$1@galaxy.uci.agh.edu.pl> <1098306421.174041@vax.ustronie.pw.edu.pl>
NNTP-Posting-Host: galaxy.uci.agh.edu.pl
Mime-Version: 1.0
X-Trace: galaxy.uci.agh.edu.pl 1098307017 27630 149.156.96.9 (20 Oct 2004 21:16:57 GMT)
X-Complaints-To: usenet@uci.agh.edu.pl
NNTP-Posting-Date: Wed, 20 Oct 2004 21:16:57 +0000 (UTC)
User-Agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (SunOS/5.8 (sun4u))
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit