You'll probably be happier using a regular expression for this kind of thing.
vougeot% cat 313208.pl #!/usr/bin/perl use strict; use warnings; my $string = 'OP=SiDarkRefRead&DEV=SI_PHOTO_DEV&CMD=READ&STATUS=PASS&R +EAD_DATA={ 3 15 0 255 50000 1000 [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] += 5 [5] = 6 [6] = 7 [7] = 8 [8] = 9 [9] = 10 [10] = 1 [11] = 2 [12] = + 3 [13] = 4 [14] = 5 [15] = 6 [16] = 7 [17] = 8 [18] = 9 [19] = 10 et +c... '; my @matches = $string =~ m!\[\d+\]\s+=\s+\d+!g; # regex matches '[', one or more digits, # ']', one or more space characters, '=', # one or more space characters, one or more digits print join "\n", @matches; vougeot% perl 313208.pl [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 6 [6] = 7 [7] = 8 [8] = 9 [9] = 10 [10] = 1 [11] = 2 [12] = 3 [13] = 4 [14] = 5 [15] = 6 [16] = 7 [17] = 8 [18] = 9
--
Allolex
In reply to Re: Splitting Data
by allolex
in thread Splitting Data
by maxl90
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |