in reply to Re^3: Seperating individual lines of a file
in thread Seperating individual lines of a file

ok, on the split function, can i split $line into two sections, one being the first 16 characters, then name the file via this string of characters?
  • Comment on Re^4: Seperating individual lines of a file

Replies are listed 'Best First'.
Re^5: Seperating individual lines of a file
by chargrill (Parson) on Feb 02, 2006 at 23:20 UTC

    If you're specifically interested in just the first 16 characters, you could also look into substr( EXPR, OFFSET, LENGTH). When I saw "host1 BUNCHOFDATAONALINE" I assumed that splitting on whitespace was what you were looking for, but when you phrase it as "one being the first 16 characters", substr comes to mind.

    You may wish to examine the differences between split and substr to see which would suit you better.



    --chargrill
    $/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );
Re^5: Seperating individual lines of a file
by blazar (Canon) on Feb 03, 2006 at 12:38 UTC
    ok, on the split function, can i split $line into two sections, one being the first 16 characters, then name the file via this string of characters?
    Yes, you can, but then chances are that substr or unpack are better suited for the tast. Split works best for splitting on a pattern. Well, more precisely it is exactly for splitting on a pattern!