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

Printing the contents of an array

Thread Next
October 22, 2009 22:52
Printing the contents of an array
Message ID:

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


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

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

Any help would be appreciated.


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.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About