>>>>> "Jose" == Jose Malacara <[EMAIL PROTECTED]> writes:

Jose> This is basically what I have now:

Jose> State=Colorado
Jose> City=Denver
Jose> City=Boulder
Jose> City=Longmont
Jose> State=Texas
Jose> City=Austin
Jose> City=Dallas
Jose> City=Houston


Jose> This is what I would like the end result to be:

Jose> State=Colorado
Jose> City=Denver
Jose> Location=DenverColorado
Jose> City=Boulder
Jose> Location=BoulderColorado
Jose> City=Longmont
Jose> Location=LongmontColorado
Jose> State=Texas
Jose> City=Austin
Jose> Location=AustinTexas
Jose> City=Dallas
Jose> Location=DallasTexas
Jose> City=Houston
Jose> Location=HoustonTexas

/me throws out a fish...

    my $most_recent_state = "Confusion"; # {grin}
    while (<>) {
      $most_recent_state = $1 if /State=(.*)/;
      print;
      print "Location=$1$most_recent_state\n" if /City=(.*)/;
    }

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to