|
Dernière réponse | |
---|---|
Sujet : [PERL] Explications sur un script SVP | |
Largo | Voila, je comprends pas trop comment ce script marche:
sub parse_csv { my $text = shift; # record containing comma-separated values my @new = (); push(@new, $+) while $text =~ m{ # the first part groups the phrase inside the quotes. # see explanation of this pattern in MRE "([^\"\\]*(?:\\.[^\"\\]*)*)",? | ([^,]+),? | , }gx; push(@new, undef) if substr($text, -1,1) eq ','; return @new; # list of values that were comma-separated } ça parse un fichier CSV en omettant les ',' qui sont entre double quote ( " ) et backslashées \, c'est l'expression régulière que je comprends pas..., si vous pouviez m'aider et décomposer le script... MERci. :hello: :hello: :hello: |
Vue Rapide de la discussion |
---|