Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Comment on

by gods
on Feb 11, 2000 at 00:06 UTC ( #3333=superdoc: print w/replies, xml ) Need Help??

Hi all,
after great help from tye and ambros on CB i get this code to work(regex done by tye and ambros)

#!"C:\perl\bin\perl.exe" use warnings; use strict; open(INFILE, '<', 'test_data.txt') or die("open failed: $!"); while (<INFILE>) { my ($ezb, $numbers) = split(';',$_); my( $pre, $in, $post )= $numbers =~ /^ ([^()]*) \( ([^()]*) \) ([^ +()]*) $/x; #my @number_split = split(',', $numbers); print "$pre\t$in\t$post\n"; }
here is some data
201.1;201(27, 28, 3, 4, 83, 84, 890, 897, 898, 9), 2054 201.2;201(1, 20-26, 29, 80-82, 891-896, 899) 201.3;201(52-54, 6, 75, 76, 85-88) 201.4;201(50, 51, 55-59, 70-74, 77-79)

the above code works for the mentioned data.


now i get something like this data

2302.1;2302, 2304(3-8, 92-99), 2305(2, 4-9) 231.1;2301, 2303, 2304(1, 2, 90, 91), 2305(1, 3), 2306, 2307, 2308

best woud be if i can place every NUMBER(numbers) in one array and the rest in one array, the stuff infront of the ; can be ignored will be splited away

idears and help greatly welcome
i tryed splitting at ( and count and recombine but this ends in a mess of nonsens
kd ultibuzz


In reply to Putting special elements from a row into an array by ultibuzz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (4)
    As of 2016-09-27 02:52 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Extraterrestrials haven't visited the Earth yet because:







      Results (493 votes). Check out past polls.