Getting unwanted list elements when using split with regex.  Here's an
example....

 

$str = "abc=In";

@arr = split(/[a-zA-Z0-9]/,$str);

foreach $a (@arr)

  {print "$a\n";}

 

I get...

 

<> 

<> 

<> 

<=>

 

If I change "abc=In" to "abcdef=In", I get 6 unwanetd null elements (one
per char before the "=").  

I was expectiing a single element list with arr[0] = "=".

 

What's Up ?    Is ther a clen way to prevent creating these unwanted
elements?

 

Thanks in Advance

-dave

Reply via email to