[EMAIL PROTECTED] wrote:
> I don't write regular expressions...ever...
>
> So can someone give me a regular expression that will remove all of
> the characters at the start of a string up to and including a "-"
> (without quotes).
s/^[^-]*-//g;
Should handle abc-123 or -1234 and give you 123 or 1234.
Wags ;)
>
> Chris Cappelletti
> IT Programmer/Analyst, Sr.
> TTM Technologies
> Desk: 425-202-9326
> Cell: 425-246-8295
> [EMAIL PROTECTED]
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> $Bill Luebkert
> Sent: Wednesday, March 09, 2005 10:35 AM
> To: '[EMAIL PROTECTED]'
> Cc: [email protected]
> Subject: Re: More time calculations
>
> Chris Cappelletti wrote:
>
>> I don't know what database you are using, but you should make your
>> database eliminate all duplicate records before perl ever gets it.
>> For instance using MS SQL you can use the word DISTINCT as in "select
>> distinct blah" which will give you one of each "blah" even if you had
>> more than one. Hope that helps.
>
> If that can't be done, a hash would probably be your best bet.
>
>
>
>> An inexperienced Perl user question, which I hope makes sense. I am
>> trying to get a list of items from a database and don't want to
>> repeat items for viewing on the web. I have tried some regexs but no
>> luck. Any thoughts?
>>
>> @zoo =("family");
>
> my %zoo = (); # or you could preload if family is a title: ('family'
> => 1);
>
>> while ( @row = $cursor_title->fetchrow_array)
>> {
>> $title = $row[0];
>>
>> if ($title =~ m/@zoo/ ) # here I don't know what to
>> insert {
>
> if ($hash{$title) {
> print $title;
> } else {
> $hash{$title} = 1;
> }
>> }
>> else
>> {
>> print "$title";
>> }
>>
>> push(@zoo, "$title");
>>
>> }
*******************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
*******************************************************
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs