Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 28th, 2012, 02:13 PM
j0mpst0rt j0mpst0rt is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 2 j0mpst0rt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 37 sec
Reputation Power: 0
Need some help stripping some data.

Ive got an array in Perl, Its extracted and converted using Dumper::

I have a array that contains the following syntax:

a\something,b\somethingelse,a\something2,c\somethe3

a and b and c can come in any order and any number of times. so for example, a\* can come 1-20 times, and b\* comes any number of times, the same as c\* comes as many times. * may be different.

I want based on a pattern match, match on either a, b, or c. which will be a variable match and replace the total contents of the array with the 'matched' set of data, and drop the unmatched (so if i want a\*, b's and c's, will be lost), and inva/vice/versa.


Can someone give me some advice on this please.

Reply With Quote
  #2  
Old November 28th, 2012, 04:07 PM
Laurent_R Laurent_R is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2012
Posts: 506 Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 4 Days 19 h 4 m 21 sec
Reputation Power: 385
Please explain your data in a more precise manner. Is it a simple array? An array of arrays? I really don't understand your data structure. May be a print-out of the Dumper output would help.

Reply With Quote
  #3  
Old November 29th, 2012, 05:05 AM
j0mpst0rt j0mpst0rt is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 2 j0mpst0rt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 37 sec
Reputation Power: 0
Further information please help me resolve.

He the inputdata looks like this: this is example only
foreach $key (keys(%{$inputdata_ref->{'Inputfilename'}{keynames}})) {
$key=~m/^(Dom|number|User|Account|PWExpire|PW|DNGPair|AO)$/ and next;
if ( defined $inputdata_ref->{'Inputfilename'}{data}{$index}{$key} ) {
$validationinfo{$dom}{user}{data}{$username}{$key}=$inputdata_ref->{'Inputfilename'}{data}{$index}{$key};
}
}

the DNGPair is a comma list of entries:
Dm\NG,Dm\NG2,Dm2\NG3,Dm\NG4

In the list of keys, Dom is the data that has to be matched against Dm, and only if theymatch, do we keep the data, I wnt therefore, to remove DM2 which doesnt apply to Dom,
so something like DOm == Dm, 'keep the data and apply it back to the same key
If there is more than one Dm that matches, append it to the same key (, separated.)

The Inputdata is from a source file.

The Validation data is another file that is used to export information from later in my script as this data has been validated.

Hope that does make sense for someone.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Need some help stripping some data.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap