Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Splitting a Text File

by choroba (Canon)
on Jul 26, 2013 at 16:19 UTC ( #1046554=note: print w/ replies, xml ) Need Help??


in reply to Splitting a Text File

If you want to capture a part of the string, you must enclose it in parentheses:

my $separator = qr/(.*)<<<(.*)>>>(.*)/; # ... if (my ($before, $name, $after) = /$separator/) { print $out $before if defined $before; close $out; open $out, '>', 'fixed_square' . $name . '.txt' or die "Unable to +write to fixed_square$name.txt: $!\n"; print $out $after if defined $after; }
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: Splitting a Text File
Download Code
Replies are listed 'Best First'.
Re^2: Splitting a Text File
by LivinTheDream126 (Initiate) on Jul 26, 2013 at 16:46 UTC
    Thank you!!! It works great now!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1046554]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2015-07-31 06:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls