I have a data file than contains 4 variables seperated by “:” for each record, like
Mark:25:male:sports
To open the file I use:
open (data, "<$file"
or &error("Unable to open the data file"
;
@data=<data>;
close(data);
What I would like to do is check the first variable of each record against a variable $check1. If they match I would like to set the following three variables of this record to the corresponding values. The result of this for the example above would be:
If $check1= “Mark”
$check2 = “24”
$check3 = “male”
$check4 = “sports”
Could some body show me what I should add to the code above to accomplish this?
Thanks,
[sig][/sig]
Mark:25:male:sports
To open the file I use:
open (data, "<$file"
@data=<data>;
close(data);
What I would like to do is check the first variable of each record against a variable $check1. If they match I would like to set the following three variables of this record to the corresponding values. The result of this for the example above would be:
If $check1= “Mark”
$check2 = “24”
$check3 = “male”
$check4 = “sports”
Could some body show me what I should add to the code above to accomplish this?
Thanks,
[sig][/sig]