develooper Front page | perl.beginners | Postings from October 2009

Printing the contents of an array

Thread Next
From:
pradeepkumar.surabhi
Date:
October 22, 2009 22:52
Subject:
Printing the contents of an array
Message ID:
3618F6648762DD40B3D44D484E115FCF0773EA32@BLR-EC-MBX04.wipro.com
Hi,

The contents in my array looks like this...
change_id="B77_ip_sync_idl"  state="released" customer_rel="B77"
change_name="ip_vke_sync" short_description="This feature introduces the
Sync idl." planned_baseline="B77_135.00"
change_id="B77_ip_sync_idl"  state="accepted" customer_rel="B77"
change_name="ip_sync" short_description="This feature introduces the
Sync ." planned_baseline="B77_136.00"

How do i just print planned_baseline="B77_135.00"  & state="released" ?

I tried the logic in the script below but it didn't help, as the fields
keep changing everytime in the array.

#!/usr/bin/perl -w

$filename="/home/pradeep/report1.txt";

open FILE, "< $filename" or die "Can't open input file: $!";

 while (my $line = <FILE>) {
          my @fields = split(" ", $line);      # Fields separated by
colons
          print "$fields[2] $fields[3]\n";     # Display selected fields
          print "@fields\n";     # Display selected fields
        }

Any help would be appreciated.

Thanks,
Prad

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About