Help make a regular season

#1,0.71,1.42,45.0,1.2$ 

This is the source text that is # parameter1, parameter2, parameter3, parameter4, parameter5 $

Tried so but without result #(?<id>),*,*,*,*$

Closed due to the fact that the essence of the issue is incomprehensible by the participants of Streletz , Bald , HamSter , Grundy , aleksandr barakin Sep 30 '16 at 10:23 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • And what should be the output? - PinkTux
  • at the exit of 5 parameters - Nikola Krivosheya

1 answer 1

If I understood correctly:

 #!/usr/bin/env perl use Modern::Perl; use Data::Printer; my $text = '#1,0.71,1.42,45.0,1.2$'; my @data; $text =~ /^#(.+)\$$/ and @data = split ',', $1; p @data; 

Conclusion:

 [ [0] 1, [1] 0.71, [2] 1.42, [3] 45.0, [4] 1.2 ] 

Or in PHP:

 $text = '#1,0.71,1.42,45.0,1.2$'; $data = explode( ',', trim( $text, '$#' ) ); print_r( $data ); 

Conclusion:

 Array ( [0] => 1 [1] => 0.71 [2] => 1.42 [3] => 45.0 [4] => 1.2 )