The following demonstrates the problem:
If I put the params in an array, the 006 collapses right off the bat:n> perl -E 'use P; my $fmt="prod\t006\t2.13\tx86_64\trpm";P $fmt; my $str=P $fmt;P "str=\"$str\""; my @flds=split /\t/,"$str"; foreach (@flds) { Pe "%s \x83", "$_"; } P " "; ' prod 006 2.13 x86_64 rpm str="prod 006 2.13 x86_64 rpm" prod 6 2.13 x86_64 rpm
Using qw the tabs don't expand (so the split doesn't work anyway), but the 6 still collapses:perl -E 'use P; my $fmt=["%s\t%s\t%s\t%s\trpm","prod", "006", "2.13", "x86_64", "rpm"] +; P "%s", $fmt; # already converted ' ["%s %s %s %s rpm","prod",6,2.13,"x86_64","rpm"]
Quirky combo to hack it:> perl -E 'use P; my $fmt=[qw(%s\t%s\t%s\t%s\t%s prod 006 2.13 x86_64 rpm)]; P "%s", $fmt; # already converted before fmt my $str=P @$fmt; P "str=\"$str\""; my @flds=split "\t","$str"; Pe "(%s) \x83", "$_" foreach @flds; P " ";' ["%s\t%s\t%s\t%s\t%s","prod",6,2.13,"x86_64","rpm"] str="prod\t6\t2.13\tx86_64\trpm" (prod\t6\t2.13\tx86_64\trpm)
But running that in the prog I ended up with:> perl -E 'use P; my $fmt=["%s\t%s\t%s\t%s\t%s", qw( prod "006" "2.13" x86_64 rpm)]; P "%s", $fmt; # already converted before fmt my $str=P @$fmt; P "str=\"$str\""; my @flds=split "\t","$str"; Pe "(%s) \x83", "$_" foreach @flds; P " ";' ["%s %s %s %s %s","prod",""006"",""2.13"","x86_64"," +rpm"] str="prod "006" "2.13" x86_64 rpm" (prod) ("006") ("2.13") (x86_64) (rpm)
!!!! Guess I'll keep poking at it... there's gotta be a way... but dang if this isn't harder than it should be...Recycling 1 duplicates...(cannot stat, already deleted?) path=/Share/s +use/distribution/12.1/repo/oss/suse/test2/smugbatch-"006"-"2.1.3".x86 +_64.rpm, dev=(undef)
p.s. maybe I'll just toss an eval on that final string and forget figuring out how to quote it...urg...
In reply to is split suppose to drop 0's from strings? by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |