CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Extracting data between arrows

 



ianilkumar
Novice

Nov 5, 2012, 10:08 AM

Post #1 of 2 (1367 views)
Extracting data between arrows Can't Post

Hi,

I want to extract string between the arrow:

Encrypted data is --->&aes|04|0D5E11BFDD97D2769D9B0DBFBD1BBF7ECE3F3BDBD15406660D3AF848C4B39A9ED8<---

Is there any built-in function available?

Regards


Laurent_R
Veteran / Moderator

Nov 5, 2012, 10:39 AM

Post #2 of 2 (1366 views)
Re: [ianilkumar] Extracting data between arrows [In reply to] Can't Post

Does the data between the arrows always have the same length? If yes, use the substr function.

Else, you may probably want to use a regex, something like this:


Code
my $extracted_line =  $1 if $total_line =~ /^-{3}>(.*)<-{3}$/;


Or you could also use the index function to find the position of the "<" near the end and then use the substr function to extract the interesting data.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives