> Actually, the content of the file looks something like:-
> name=john
> id=12345
> password=12345
> colour=blue

Ok, how about this then...

This is based on the fact that name, id, password, colour appear for every record 
whether they have a value or not, and that none of the values after the '=' will have 
an '=' in them.

<code>  
#!/usr/bin/perl

use strict;
my(@name,@id,@password,@colour);
open(FILE,'<file.txt') or die "Can't open file.txt: $!\n";
my @text=(<FILE>);
close(FILE);

for(@text) { s/.*=//; }

for(my $x=0; $x < $#text; $x+4;) {
  push @name, $text[$x];
  push @id, $text[$x+1];
  push @passowrd, $text[$x+2];
  push @colour, $text[$x+3];
}

for(@name) { print if($_); }

exit;
</code>


It is still way too early, so if you catch any errors, let me know David (or anyone 
else for that matter) :-)

shawn


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

Reply via email to