Hi, i've tried both your suggestions but can't seem to make it work. It gives me 2 errors:
X:\bla\script.pl Denemarken.csv xx.csv syntax error at X:\bla\script.pl line 55, near "$elements[" syntax error at X:\bla\script.pl line 82, near "}" Execution of X:\bla\script.pl aborted due to compilation errors.
This is my entire code:
if ($#ARGV != 1) {print "usage: input-file output-file \n";exit;} $inputfile=$ARGV[0]; $outputfile=$ARGV[1]; open(INFILE,$inputfile) || die "Bestand niet gevonden :$!\n"; open(OUTFILE,">$outputfile") || die "Bestand niet gevonden :$!\n"; $i = 0; @infile=<INFILE>; foreach ( @infile ) { $infile[$i] =~ s/"//g; @elements = split(/;/,$infile[$i]); # Number clean if (!($elements[20] =~ /^\+45\s{1}\d{4}\s{1}\d{4}$/)) { $elements[20] =~ s/\D//g; } $elements[20] =~ s/(^00|^0)//i; if ($elements[19] =~ m/45/g) { $elements[20] =~ s/^/\+45 /; $elements[19] =~ s/45/xxxx/; } $elements[20] =~ s/(^450|^45)/\+45 /; if ($elements[20] =~ m/^[1-9]/i) { $elements[20] =~ s/^/\+45 /; } if ($elements[20] =~ /^\+45\s{1}\d{9,}$/) { $elements[25] = 'TE LANG NR'; } if ($elements[20] =~ /^\+45\s{1}\d{1,7}$/) { $elements[25] = 'TE KORT NR'; } if (!($elements[20])) { $elements[25] = 'GEEN NR BEKEND'; } while (my $elements[20] = <INFILE>) { substr $elements, 7, 0, ' '; } # Zipcode clean $elements[15] =~ s/\D//g; if (!($elements[15])) { # do nothing } else { $elements[15] =~ s/^/DK-/; } # Netnumber clean $elements[19] =~ s/\<not in use\>/xxxx/i; $elements[19] =~ s/45/xxxx/; if (!($elements[19])) { $elements[19] = 'xxxx'; } @elements = join(";",@elements); print OUTFILE "@elements"; $i = $i+1; } close(INFILE); close(OUTFILE);
Can either of you tell me what i'm doing wrong and point me in the right direction? Because i think this is as far as my knowledge goes on the subject

In reply to Re: Add whitespace in middle of string (substr?) by Janwhatever
in thread Add whitespace in middle of string (substr?) by Janwhatever

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.