Mark Yannuzzi, <myannuzzi@aya.yale.edu> wrote: >I am trying to 'split' the following line: > ><ASCII 10> YY,XX BIN # 1-IDSXP # 2-VGS1P # 8-IGSO # 10-VGF \n > ^ ^^^ ^ ^^ ^^^ ^^ ^^^ ^^ ^^^^ ^ ^^^^ >where ^ = whitespace. I need the line to be place into the array as follows: > >[YY,XX] [BIN] [# 1-IDSXP] [# 2-VGS1P] [# 8-IGSO] [# 10-VGF] > ^^ ^^ ^^ ^ >so that the numerical data lines that follow will correlate (array >index-wise) with these headers. I have tried various combos of /s, etc., >but the varying whitespaces are reeking havoc. Sometimes, I will also >end up with the fist element of the array containing the NULL character. > >Anyone's help would be greatly appreciated, I am new to Perl and have not >mastered regular expressions yet... Chapter 9 in MacPerl Power and Ease has some good info on using the /x modifier to allow your regex's to have extra whitespace and comments to make them clearer. I've found this useful when developing a complicated regex. There's also some good info on this in the Camel book (second edition), which unfortunately I don't own. It really sounds like what you want is a multi-dimensional array (or a multidimensional hash). I'll leave that to other more capable sorts. # Fungal Parataxonomy Mycology Information (Mycoinfo) # Webmaster, Staff Writer **The World's First Mycology E-Journal** # <mailto:webmaster@mycoinfo.com> <http://www.mycoinfo.com/> # "A couple of guys trying to do something great..." ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch