In the last 3 lines of code, how can I loop through the array @zips and put " around each value as it was when I read the file? I can add a few lins and split it into an array. Then for each value of the new array, print the " and then the value, but that is not cool.

I use to work with someone who I think use to do things like this with map and split and I could NEVER figure out how to use map - lol. I know it can be done with a line or 2 but I dont know how. Input looks like this:
"Anawalt","WV","24808","304","54047","McDowell","P", "Anch","AK","99505","907","02020","Anchorage","N", "Ancho","NM","88301","505","35027","Lincoln","A", "Anchor","IL","61720","309","17113","McLean","P", "Anchor","MS","39776","662","28017","Chickasaw","N",
The code reads in the file and removes the quotes and the carriage return.
while (<IN>){ next if (/^#/); chomp; tr/\"//d; y($city,$state,$zip,$area_code,$fips,$county,$pref,$type) = split ( +/\,/); if ( I want this zip code){ . . . } else{ push (@zips,$_); close(ZIPS); } } #### The question is for the print below #### How can I print " around each value foreach (@zips){ print ; }

In reply to loop through values in a string and print " " around each value. by kevyt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.