Hi,
On Fri, Dec 14, 2012 at 2:53 PM, samuel desseaux <[email protected]>wrote:
> Hi!
>
> I work in a library and i need to have several fields in one line
>
> Example
>
> I have this
>
> =995 \\$xPR$wLivre
> =995 \\$bECAM$cECAM
> =995 \\$n
> =995 \\$oDisponible
> =995 \\$kG1 42171
>
>
> and i want in one line
>
> =995 \\$bECAM$cECAM$kG1 42171$n$oDisponible$xPR$wLivre
>
Using Dr., Ruud's data. This is another way of doing it:
use warnings;
use strict;
my %data_collection;
while (<DATA>) {
chomp;
my ( $key, $value ) = split /\s+/, $_, 2;
push @{ $data_collection{$key} }, $value;
}
print $_, " ", @{ $data_collection{$_} }, $/ for keys %data_collection;
__DATA__
=995 \\$xPR$wLivre
=995 \\$bECAM$cECAM
=995 \\$n
=995 \\$oDisponible
=995 \\$kG1 42171
zz 1
zz 2
zz 3
--
Tim