in reply to Interpret a string that contains strings

Single quotes don't interpolate variables. '$format ' (see line 9) contains a dollar sign, and letters f, o, r, m, a, t, and a space.
$formatString = "$formatString$format ";

Similarly, use "\n" instead of '\n' on line 13.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Interpret a string that contains strings
by bArriaM (Novice) on Nov 21, 2015 at 23:00 UTC

    I shouldn't drink wine and code at the same time... Thank you Sir, it works like a charm after the changes, I wanted to make it too complicated!

    sub printfToFile { my $file = shift; my $format = shift; my $arrayCount = @_; my $formatString; for (my $r = 1;$r <= $arrayCount; $r++) { $formatString = $formatString."$format "; } $formatString = trim( $formatString ); $formatString = $formatString."\n"; open IO, ">>$file" or die "Cannot open $file for output: $!\n+"; printf IO "$formatString", @_; close IO; }