Home  |  Linux  | Mysql  | PHP  | XML
From:Eelco Alosery Date:Thu Jan 29 16:37:17 2004
Subject:Re: [MacPerl-AnyPerl] Sorting a file list
Thanks John,

And when i use this part to open the data file

open (DATABASE, "$database") || die "Can't Open $klantfile";
while(<DATABASE>)
{
($date, $text1, $text2) = split(/\|/,$_);
foreach ($date)
{		
print <<ENDOFTEXT;

some html text
ENDOFTEXT
}
}
close (DATABASE);

how do i combine this together




Op 29-jan-04 om 23:58 heeft John Delacour het volgende geschreven:

>
> At 11:19 pm +0100 29/1/04, Eelco Alosery wrote:
>
>> the strings are formated this way
>>
>> 01-12-2003|some text|soem other text|
>> 03-12-2003|some text|soem other text|
>> 10-12-2003|some text|soem other text|
>
>
> Then it's very simple:
>
>
> my @temp;
> my @lines = split "\n", <<_;
> 01-12-2003|some text|soem other text|
> 03-12-2003|some text|soem other text|
> 10-12-2003|some text|soem other text|
> 06-12-2003|some text|soem other text|
> 04-12-2003|some text|soem other text|
> _
> for (@lines) {
>   s~^(..)-(..)-(....)(.+)~$3$2$1$4~;
>   push @temp, $_ ;
> }
> for (sort @temp) {
>   s~(....)(..)(..)(.+)~<div>$3-$2-$1$4</div>\n~;
>   print;
> }
>
> You would substitute <FILEHANDLE> for @lines
>
> JD
>

Navigate in group perl.macperl.anyperl at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants