split()
function to turn delimited strings into arrays:while (<DATA>) { chomp; # Get rid of \n @columns = split(/,/, $_); print "Company: $columns[1]\n"; print "Slogan: $columns[3]\n"; } __DATA__ 12917,MegaDodo Inc.,ABC2010,Take it slow 27981,Frobozz Ltd.,GEF2981,Don't sweat it |
Company: MegaDodo Inc. Slogan: Take it slow Company: Frobozz Ltd. Slogan: Don't sweat it |
Forward to 20 Minutes: Text to data: hashes I
Back to 20 Minutes: Regular Expressions IV Up to PerlInside section index Up to Perl Inside course index |
Perl Inside: PerlInside - 21
Copyright © 1999, Brian Jepson
|