Thread splitten in array (8 answers)
Opened by kabazza at 2007-01-10 16:07

bloonix
 2007-01-10 16:23
#73048 #73048
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
[quote=renee,10.01.2007, 15:11]
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/perl

use strict,
use warnings;

my $file = '/path/to/file';
my @array;
{
   local $/ = "\n//\n";
   open my $fh,'<',$file or die $!;
   @array = <$fh>;
   chomp @array;
   close $fh;
}



Mehr zu $/ unter perlvar...[/quote]
Wofür @array = <$fh>;? Die \n werden schon durch
local $/ = "\n//\n"; "gefiltert". =)

Edit: ich meinte nicht @array = <$fh>; sondern chomp @array\n\n

<!--EDIT|opi|1168439243-->
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.

View full thread splitten in array