develooper Front page | perl.perl5.porters | Postings from June 2003

Split command using a variable

Thread Previous
June 25, 2003 08:48
Split command using a variable
Message ID:


I am trying to use a split command to read a certain field. The file can
come with any type of variable.  Only thing constant is the length of the
first field which is 3 charectors. The forth charector is the field
delimiter for the file.
Can I use the split command like follows? 
@tags=split( /$sep/, $line);

while ($line=<INFILE>) {
# @tag=split(/:/, $line);
if ($flag eq "UNB") {
$EDI = "NO";
if ($EDIFACT eq "YES") {
@tags=split( /$sep/, $line);
$tag = $tags[10];
print ($tag);
  if ($tag eq "T" ) {
     $tflag = "YES";
     print $tag;
	print $tags[10];
  elsif ($tag eq "P" ) {
   $tflag = "NO" ;
   print $tag;
	print $tags[10];

Thank you 


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