Thread Filehandle auf __DATA__ übergeben (13 answers)
Opened by pktm at 2011-03-31 12:34

GwenDragon
 2011-03-31 12:46
#147214 #147214
User since
2005-01-17
14590 Artikel
Admin1
[Homepage]
user image
DATA ist doch ein globales Filehandle, also einfach einen Alias drauf. ;)
my $fh = *DATA;

Also:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl

use strict;
use warnings;
use utf8;
use FileHandle;

my $fh = *DATA;
if( $fh ) {
        print $fh->getlines();
}else{
        print "no fh";
}

__DATA__
A
B
X
Y
Z


Ergibt:
A
B
X
Y
Z



EDIT: Kaum kurz mal am Telefon abgelenkt, kommen die Tipps massenweise. ;)
Last edited: 2011-03-31 12:48:47 +0200 (CEST)
die Drachin Gwen

View full thread Filehandle auf __DATA__ übergeben