Sudhindra K S wrote:
> 
> Hi

Hello,

> I have a file with lines as shown below
> 
> //abc/... - //xyz/...
> //abc1/... - //xyz1/...
> 
> Now i want to split the lines at "-" and get the string on the left in one
> array and the string on the right in another array.
> 
> ie: array1 = (//abc, //abc1) and array2 = (//xyz, //xyz1).
> 
> How do i do this?

my ( @array1, @array2 );
my $save_flush = $|;
$| = 0;
while ( <FILE> ) {
    push @{ --$| ? [EMAIL PROTECTED] : [EMAIL PROTECTED] }, $_ for split /\s*-\s*/;
    }
$| = $save_flush;



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to