$data = "A Tab Separated Data File"; @fields=split(/\t/,$data); print "$fields[0] , $fields[1], $fields[2] , $fields[3] ";
Urmil -----Original Message----- From: Scott, Joshua [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 2:27 AM To: beginners Subject: Using defined array with split command Good evening, I'm having a hard time figuring out how to make a portion of my script work. Basically I'd like to split a specific field and use the names from an array as the scalar variable names for each field. Here is a snip of my code: # Begin Code $data = "A Tab Separated Data File"; @fields = qw/field1 field2 field3 field4 field5/; (@fields) = split("\t",$data); Print "$field2\t"; Print "$field3\n"; # End Code The print statements don't output "Tab" or "Separated" like I'd like them to do. What am I doing wrong here? What is the best way to do this type of function? Thank you very much for any assitance you can provide. Joshua Scott Security Architect, CISSP 626-568-7024 ============================================================================ == NOTICE - This communication may contain confidential and privileged information that is for the sole use of the intended recipient. Any viewing, copying or distribution of, or reliance on this message by unintended recipients is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. ============================================================================ == -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]