> my $date =~ s#(\d{2})(\d{2})(\d{4})#$1/$2/$3#;
That amazingly, doesn't have much performance loss to it.
I just did:
sub build_list_news {
my $newstext = "<table DEFANGED_width='\"100%\"'>";
my %news = get_news();
foreach (keys %news) {
$news{$_}{ctime} =~
s#(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})#$1/$2/$3 $4:$5:$6#;
$newstext .= "<tr><td DEFANGED_align='\"center\"'>$news{$_}{ctime} -
<b>$news{$_}{subject}</b></td>
</tr><tr><td>$news{$_}{news}</td></tr>";
}
$newstext .= "</table>";
return $newstext;
}
and I get results at pretty much the same speed I was before I added the
regex.
So, even if there is a performance loss, it's still less then the lagtime
between my workstation and the server it talks to through a 100base hub..
(which is by no means significant)
> i use #'s as delimaters here... some other character may be more appropriate
I found them to be perfect when dealing with date/time stamps.
Dennis
> At 07:49 AM 6/26/2003 -0700, Sara wrote:
> >I have a database with the following fields.
> >
> >lname fnam M
> >acct# mrm birth Postdate Post# drln drfn
> > m disch
>
>DOE,JOHN,R,00037839842,207337,02151956,04072003,01980,LastName,FirstName,L,04
102003
> >
> >I have a very simple script which splits the delimiter , and shows the
> >result in the same format as in database.
> >I want to do following things using regex, but I have tried my options to
> >my level best, ::) no results yet,
> >
> >1- Remove all the leading 000 from any field like acct# = 00037839842
> >should be 37939842 and Post# should be 1980
> >
> >2- Want to format dates like birth = 02151956 should be 02/15/1956
> >
> >Any help??
> >
> >Thanks,
> >
> >Sara.
>
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]