On 08/29/2006 08:23 AM, Sayed, Irfan (Irfan) wrote:
Hi All,
I need to use the split function in perl script.
* /vobs/apache_log4j
/usr/add-on/puccase_vob01/ccvob01/apache_log4j.vbs public (replicated)
Above line i need to split in following order
*
/vobs/apache_log4j
/usr/add-on/puccase_vob01/ccvob01/apache_log4j.vbs
public
(replicated)
I tried the following command
my @vob_path = split(/ /, $vob_list); where $vob_list contains the
actual line.
but i am not getting the output as i want.
can anybody please help.
Regards
irfan
You didn't say what was wrong with your output, but I think
that you can fix it by creating a character class containing
both space and newline and splitting on that:
use Data::Dumper;
my $vob_list = q{* /vobs/apache_log4j
/usr/add-on/puccase_vob01/ccvob01/apache_log4j.vbs public
(replicated)};
my @vob_path = split (/[ \n]/, $vob_list);
print Dumper([EMAIL PROTECTED]);
__END__
Next time, rather than to say "I am not getting the output as
I want," instead say something like "The output is wrong
because I am getting /vobs/apache_log4j inside the same
element as /usr/add-on/...."
HTH
PS.
Thanks for spelling words properly.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>