On Mon, 9 Jun 2003, Zbynek Houska wrote: > dear all, > > I wonder how to initialize and use "split" function in this case: > > here are some datas (stored in file): > > 28.10.2002 06:47 <DIR> Almighty - Just add life > 28.10.2002 06:47 <DIR> Anastacia - Freak of nature > 28.10.2002 06:47 <DIR> Anastacia - Not that kind > 28.10.2002 06:47 <DIR> Anathema - (1998) Alternative 4 > 28.10.2002 06:47 <DIR> Ancient - The Halls Of Eternity > 28.10.2002 06:47 <DIR> Annie Lenox - Diva > 15.11.2002 09:46 <DIR> Aerosmith > 22.11.2002 08:37 <DIR> Blind Guardian - A Night At The Opera > 28.11.2002 11:04 <DIR> Craig David - Slicker Than Your > Average > > and I would like to wipe out all dates a <DIR> prefixes. Only third column > should be sorted and printed... > I have this simple script: > > #!/usr/bin/perl -w > $file=""; > @list=(); > @result=(); > print 'Which file do you want to open: '; > chomp ($file=<STDIN>); > open (FILE, "$file"); > @list=<FILE>; > @result = sort {$a cmp $b } @list; > print "@result"; > > It works great, but I really don't know how to properly use/initialize split > (or maybe %hash).I know I should use something like this: > @list= split (' ', $file), but it doesn't work, it returns file name only... > So, could someone help me? >
After: @list=<FILE> do: foreach (@list) { chomp; $_=(split(/ /,$_))[3]; } **** [EMAIL PROTECTED] <Carl Jolley> **** All opinions are my own and not necessarily those of my employer **** _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs