http://www.perlmonks.org?node_id=696637


in reply to Re^2: Parsing a Variable Format String
in thread Parsing a Variable Format String

Something like:
qr/(CT|CL)\s+([#]?)\s*(\d+)\s+(\S+)/, => sub { $_->{CTorCL} = $1; $_->{CycleTime} = $3; $_->{Locks} = ($2 eq "#" ? "ON" : "OFF"); $_->{Rotation} = $4; }
Note I put the values in a hash. Otherwise you'll have to explicitly declare or reset your variables so one call won't interfere with subsequent calls.