Hi all. Is it possible to use a defined variable in defining another variable? See example below, which is not working.
$ecounter=0; my @file_line_contents = split (/\|/,$_); while "$ecounter < 45" { $e$ecounter=length($file_line_contents[$ecounter]); $ecounter+=1; }
I tried concatenating the variables and that did not work either. Code is probably ugly but should convey basically what I am trying to do.
Thanks in advance
Update
I am doing validation of data. I have a file of records with 46 elements in each record. I need to validate the length of each element as well as do some content validation. This is why I was creating a variable containing the length for each. Is there a better way?
Thanks for pointing out the syntax errors. I'm not surprised. I did not check that before posting question. Just wanted to get the idea across.
In reply to Using a variable to define a variable by insta.gator
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |