in reply to I'm splitting a scalar and putting the results in an array. Why is the first element empty?

The specified regexp is used to locate the seperator. split returns the two items being seperated by the seperator (as well a the seperator because of the parens). In this case, that's the string "" and "Any garbled crap2345n&%]i".

Regexps are more apt at extracting data when there is no clear, repeating seperator.

@MatchFoundArray = $WikiHistory =~ /(\* \[)(.*)/;
  • Comment on Re: I'm splitting a scalar and putting the results in an array. Why is the first element empty?
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: I'm splitting a scalar and putting the results in an array. Why is the first element empty?
by meanroy (Acolyte) on Aug 10, 2006 at 22:01 UTC
    Oh DUH! Most Excellent!
    Both instant answers brought me enlightenment, Thanks a bunch!