in reply to How do I select text between two bits of text?

I'm guessing he's manually parsing a page where the format is known, so he can extract information, and this isn't going to be a long-term thing that runs automatically. Therefore, a simple regex should do fine.

For multiple matches:

use strict; use warnings; my ($SFS, $device); $SFS = join '', <DATA>; while ($SFS =~ m|<a name="(.*?)"|sg) { $device = $1; print "$device\n"; } __DATA__ <a name="alpha"></a> <a name="bravo"></a> <a name="charlie"></a>

To the OP: It's generally better practice to give us a sample of the input data (in this case, the HTML page) so we can be sure to give you exactly what you need.