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


in reply to newbie need help with a simple code

unclear, do you need certain columns or certain rows?

using split should help in both cases

DB<108> $line='ATOM 1287 O LYS B 65 49.675 57.571 62.721 1.00 31.87 +O' => "ATOM 1287 O LYS B 65 49.675 57.571 62.721 1.00 31.87 O" DB<109> @col =split / /,$line => ( "ATOM", 1287, "O", "LYS", "B", 65, "49.675", "57.571", "62.721", "1.00", "31.87", "O", ) DB<110> @col[1..3,5] => (1287, "O", "LYS", 65)

Cheers Rolf