I have to use the split command on the same file to split each input record on its delimiters and and assign it to an array. I am trying to use eval here also (as specified above), but, it is throwing an error. One of the error msg is
"Bareword "per" not allowed while "strict subs" in use at (eval 2) line 1."
Thanks for your help!!!#!/usr/bin/perl use Fcntl; use strict; print "starting script..."; my $inp_row = "per|l|mo|nks|rock|s"; my $de = '|'; my @cl_data_row; my $count = (eval "\$inp_row =~ tr/$de//"); die $@ if $@; print "count is $count\n"; chop($inp_row); #@cl_data_row=split(/\|/,$inp_row); @cl_data_row=(eval"\split(/\$de/,$inp_row)"); for (my $x=0;$x<$count;$x++) { print "row element is $cl_data_row[$x]\n"; }
In reply to Re^2: Regex - counting number of '|'
by perl_junkie
in thread Regex - counting number of '|'
by perl_junkie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |