2010/9/25 Santana <[email protected]>:
> Hi all,
> i'am newbie in PERL and i would liked your point of views/opinion for
> the following situation :
>
> i have a file with some lines that presents this format of
> information :
>
> ....
> Anne Gomez ; "5th Avenue ;";"925 NY  " ; 1978/10/11
> ...
>
> the ";" is the separator of fields and i know the folling :
>
>
>
> 1ªfield = Anne Gomez
> 2ªfield = 5th Avenue ;";"925 NY
> 3ªfield = 1978/10/11
>
>
> The 2º field presents as value one or several semin-colon(";") and one
> or several single quote. Do you think there is possbile with any
> regular expression  to extract the fields as i describe previous ?
>

The code:

use strict;
use Data::Dumper;

my $str = "Anne Gomez ; \"5th Avenue ;\";\"925 NY  \" ; 1978/10/11";
my @re = $str =~ /^(.*?)\;(.*)\;(.*)$/;
print Dumper \...@re;


The result prints:

$VAR1 = [
          'Anne Gomez ',
          ' "5th Avenue ;";"925 NY  " ',
          ' 1978/10/11'
        ];

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to