0

Is it possible to assign to an array the parts of a block of text that is delimited by < >. For example,

sometexthere <[email protected]> more text
more text moretext <[email protected]>

should produce

@array = qw([email protected] [email protected]);

How can I accomplish this?

1

1 Answer 1

4
my @array = $text =~ /<([^<>]+)>/g;
Sign up to request clarification or add additional context in comments.

2 Comments

this is exactly what i needed. Could you explain to me how it works or what each character is doing (ie the ^ before <>) Thank you for the answer btw too.
[^CHARS] matches any one character that isn't in CHARS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.