guys-
is there a way to ignore characters you are unpacking?
unpackin();
sub unpackin
{
my $text = 'girl,you,really,got,me,now,you,got,me,so,i,dont,know,w
+hat,im,doin,666,777,99.99';
my @ar = split /,/, $text ;
my @lens = map { length } @ar ;
my $index = 0;
my $format = '';
foreach my $len (@lens)
{
$format .= "A$len" . 'A';
}
my $odd= 1;
my @words = grep { ($odd) ? ($odd=0)+1 : ($odd=1)-1 ;} unpack($for
+mat, $text );
print "( @ar )\n";
print "( @lens )\n";
print "format = $format\n";
print join "|", @words;
print "\n";
}
produces
( girl you really got me now you got me so i dont know what im doin 66
+6 777 99.99 )
( 4 3 6 3 2 3 3 3 2 2 1 4 4 4 2 4 3 3 5 )
format = A4AA3AA6AA3AA2AA3AA3AA3AA2AA2AA1AA4AA4AA4AA2AA4AA3AA3AA5A
girl|you|really|got|me|now|you|got|me|so|i|dont|know|what|im|doin|666|
+777|99.99
i'd love to be able to do this without having to skip every other element in the result aray...
thanks