Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to extract this??????

Status
Not open for further replies.

PerlElvir

Technical User
Aug 23, 2005
68
Hi all I have one problem, so...I hope that someone can help ;)

Ok so I have array which have always 1 element and from that first element I have to pars it like this:

Example

my @ace_param1 = ("Thu 27 Apr 20:50 Mexico City 14:35 +1 Frankfurt LH499 13h00 Business Flex (C) Fri 28 Apr 15:40 Frankfurt 16:50 Paris LH4224 Business Flex (C) <td height=\"1\"");

so from this element I need to get like this:

1.always first and last hours - like here hour=20:50 and hour1=16:50
2.code - LH499 and LH4224

sometimes array look like this:

my @ace_param1 = ("Thu 27 Apr 20:50 Mexico City 14:35 +1 Frankfurt LH499 13h00 Business Flex (C) ");

so I need same information, but in this case:

1.always first and last hours - like here hour=20:50 and hour1=14:35
2.code - LH499

I hope that someone can help ;)
 
Code:
@data=split(/\s/, $ace_param1[0]);
$hour1=$data[3];
$hour2=$data[5];
#is that +1 always going to be present as +0, or -0?
#if so
$code=$data[8];
#else
$code=$data[7];
if ($code=~m/^[+-]/) { #this I'm not sure of, but I'm sure you know what I mean ;-)
   $code=$data[8];
}

Not tested, but should at least point you in the right direction

HTH
--Paul

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top