Schrift
[thread]8646[/thread]

fortlaufende Nummer in Variablenname (Seite 2)

Leser: 1


<< |< 1 2 >| >> 16 Einträge, 2 Seiten
bloonix
 2007-01-16 09:54
#73235 #73235
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
Der Hash macht Sinn, wenn EagleFox die Dateinamen d1, d2 etc.
zufällig gewählt hat und er die Dateinamen als Hashkey nutzen möchte.
Die Zeilen würde ich dann in ein Array packen.
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.
bloonix
 2007-01-16 09:57
#73236 #73236
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
[quote=GoodFella,16.01.2007, 06:45]
Code (perl): (dl )
open(F, "<$file") or die "Konnte $file nicht öffnen.";
[/quote]
Globale Filehandles sollte man vermeiden und $! verrät, warum eine Datei
gegebenfalls nicht geöffnet werden konnte.
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.
renee
 2007-01-16 10:12
#73237 #73237
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Und man sollte das open mit 3 Parametern verwenden (siehe auch perldoc -f open)
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
betterworld
 2007-01-16 10:21
#73238 #73238
User since
2003-08-21
2614 Artikel
ModeratorIn

user image
[quote=renee,15.01.2007, 15:40]
Code: (dl )
       $hash{$_}->{$data_counter}->[$line_counter} = [$spalte1, $spalte2, $spalte3];
[/quote]
Muesste da nicht $index statt $_ stehen?

Ansonsten schließe ich mich murphy und goodfella an: Lieber Arrays benutzen.
renee
 2007-01-16 10:23
#73239 #73239
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
jepp, hast recht.
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
betterworld
 2007-01-16 10:25
#73240 #73240
User since
2003-08-21
2614 Artikel
ModeratorIn

user image
[quote=opi,16.01.2007, 08:57][quote=GoodFella,16.01.2007, 06:45]
Code (perl): (dl )
open(F, "<$file") or die "Konnte $file nicht öffnen.";
[/quote]
Globale Filehandles sollte man vermeiden und $! verrät, warum eine Datei
gegebenfalls nicht geöffnet werden konnte.[/quote]
Also noch mal zusammenfassen (auch das, was renee gesagt hat):
Code: (dl )
1
2
open(my $fh, "<", $file) or die "Konnte $file nicht öffnen: $!.";
my @tmp = <$fh>;
<< |< 1 2 >| >> 16 Einträge, 2 Seiten



View all threads created 2007-01-15 15:15.