Re: better idiom for appending to list from file
- From: "Brian McCauley" <nobull67@xxxxxxxxx>
- Date: 31 May 2006 10:36:06 -0700
Mirco Wahab wrote:
Hi all,
is there a typical Perl-spell when
having a list:
@Array = qw( a b c d );
that needs to be appended from a file:
[somefile.txt]
ee
ff
gg
hh
[EOF]
I'd use
splice @Array, @Array, 0, map{ chomp; $_ } <FH>;
for that, but it may look ugly to others.
Any ideas?
push @Array, <FH>;
chomp @Array;
This harmlessly chomps the elements that were already in @Array.
.
- References:
- better idiom for appending to list from file
- From: Mirco Wahab
- better idiom for appending to list from file
- Prev by Date: Re: safe-module and namespaces
- Next by Date: Re: Searching large files with a regex and a list
- Previous by thread: Re: better idiom for appending to list from file
- Next by thread: Convert string into incremental date
- Index(es):
Relevant Pages
|