Re: misunderstanding with the function split
- From: krahnj@xxxxxxxxx (John W. Krahn)
- Date: Mon, 17 Jul 2006 17:37:02 -0700
sfantar wrote:
John W. Krahn a écrit :
#!/usr/local/bin/perl
use strict;
use warnings;
my @authors;
my @titles;
for my $file ( @ARGV ) {
$file =~ tr/ /_/;
my ( $author, $title ) = split /-/, $file;
push @authors, $author;
push @titles, $title;
}
__END__
Thank for your explanation.
Can I use a hash array to do what I wanted initially that is to say if I
choose an author then I get his songs ?
For instance : Freda Payne -> first_song.mp3
-> second_song.mp3
The name of the author must be the value and not the key because we
can't have two equal keys. Is that right?
Yes, hash keys are unique so you probably want to use a Hash of Arrays.
perldoc perldsc
perldoc perllol
John
--
use Perl;
program
fulfillment
.
- References:
- misunderstanding with the function split
- From: Sfantar
- Re: misunderstanding with the function split
- From: John W. Krahn
- Re: misunderstanding with the function split
- From: Sfantar
- misunderstanding with the function split
- Prev by Date: Re: misunderstanding with the function split
- Next by Date: pattern matching
- Previous by thread: Re: misunderstanding with the function split
- Next by thread: Re: misunderstanding with the function split
- Index(es):
Relevant Pages
|