I'm new to perl (and actually not even really trying to develop this skill - I inherited some code and am trying to enhance it).

Basically, I want to get the text between parts of a text string.
How do I get the parsed variable to contain "WHATEVER IT IS"?

#!/usr/bin/perl
$var="BLAH{108:WHATEVER IT IS}HEY";
$parsed=($var =~ /\{108:(\w*)\}/); 
print "PARSED:$parsed\n";

Recommended Answers

($parsed) = $var =~ /\{108:([^}]*)\}/;
Jump to Post

All 2 Replies

($parsed) = $var =~ /\{108:([^}]*)\}/;
($parsed) = $var =~ /\{108:([^}]*)\}/;

Worked like a charm. Thanks! (Maybe some day I'll understand it)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.