Hello to all,
I have recently started with perl. Sorry for my English.
I have some Dupplicate in Path variable.(by the installation of some apps that you can see two identical addresse written in Path).
my goal is that I just change path and these changes may remain when I reboot system. I have a script with perl written that you can delete dupplicate but in the end I see it again. This means my script has no effect on Path enviroment variable.
how can I change that path variable so stay with the reboot the changes?
thank you for your help in advance
here is my code:

........for test........
#<<forTest $ENV{'PATH'}='/bin;/usr;/bin;/usr/local/bin:/home/fred/bin'; #<< or $t = $ENV{'PATH'}; @array=split(/;/,$t); # zeigt jede node vom array foreach (@array){ # print "$_\n"; } $flag = 0; for ($i=0;$i<@array.length;$i++) { for ($j=$i+1;$j<@array.length;$j++) { if (@array[$i] eq @array[$j]) { print "[", @array[$i], "]"; print " is equal to " ; print "[", @array[$j], "]"; print " index vom array : "; print $i ; print ","; print $j , "\n" ; @array[$i] = ''; $flag = 1 ; } } } if ($flag == 0) {print "no Duplicate :D \n";} foreach (@array){ # print "$_\n"; } print " old Path: \n"; print $ENV{'PATH'}; print " \n"; print " new Path: \n"; $TEMP = ''; for ($i=0;$i<@array.length;$i++) { if (@array[$i] eq '') {$TEMP = $TEMP . @array[$i] ;} else {$TEMP = $TEMP . @array[$i] . ';';} } $ENV{'PATH'} = $TEMP ; print $ENV{'PATH'}; print " \n";
............................

In reply to how I can with perl script change path variable so that the changes remain with the system reboot? by zeus83

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.