Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Joining two strings by matching positions of an alphabet in both strings in Perl



prashant
New User

Oct 9, 2012, 9:30 PM


Views: 11025
Joining two strings by matching positions of an alphabet in both strings in Perl

I need a Perl script where a string get fragmented at every occurrence of 'E' and when user enters positions of 'C' through command line (say 3-8 or 3-8,13-18 or any comma separated such positions of 'C' according to the string in such format if the string is long), the fragments containing 'C' (say at 3 and 8 positions) should be joined and shown in the output.

Suppose string is "ABCDEABCDEABCDEABCDEABCDE" and user enters 3-8 then program oputput should be-

ABCDEABCDE

ABCDE

ABCDE

ABCDE


prashant
New User

Oct 14, 2012, 9:43 PM


Views: 10834
Re: [prashant] Joining two strings by matching positions of an alphabet in both strings in Perl

Somebody help please!


Laurent_R
Veteran / Moderator

Oct 15, 2012, 4:08 AM


Views: 10808
Re: [prashant] Joining two strings by matching positions of an alphabet in both strings in Perl

I would be glad to help and it does not seem to be very difficult, but I don't understand what you are trying to do.


BillKSmith
Veteran

Oct 16, 2012, 5:51 AM


Views: 10783
Re: [prashant] Joining two strings by matching positions of an alphabet in both strings in Perl

Please post the specifications that you had in the intermediate forum. We will have more questions, but that would be a start.

Questions that I do remember:

Does every segment contain a 'C'?

Can a segment be used in more than one pair?

Are you using ActiveState perl? I would like to use their prompt module.
Good Luck,
Bill