I have a long regular expression that parses a text file in various matching variables.
To ensure reliability, matching variables are likely to contain spaces. I would like to remove the gaps systematically, iterating over matching variables.
For example, I have matching variables $2 through $14 , which contain some spaces.
I could do:
my @columns = my ($serNum, $helixID, $initResName, $initChainID, $initSeqNum, $initIcode, $endResName, $endChainID, $endSeqNum, $endICode, $helixClass, $comment, $length) = ($2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14);
But this only removes the gap in the elements in @column and leaves the correctly named scalars, $serNum , $helixID , etc., untouched.
Is there a way to remove the empty space in each of the matching variables before copying them to more well-known scalars, or is there a way to iterate through these self-observable scalars and remove the spaces there?
I suppose there might be some way to do this with links.