in reply to extracting integers from bracketes when reading from file...
I’m not sure about whether you are asking any question at all, but it seems you need to allow some whitespace between the square brackets in the data and the digits:
my @numbers = $file_content =~ /\[\s*(\d+)\s*\]/g;
FWIW, I suggest using the /x option for the pattern, so that you can use whitespace to structure it:
my @numbers = $file_content =~ / \[ \s* (\d+) \s* \] /gx;
See perlretut in Building a regexp.
Makeshifts last the longest.
|
|---|