Thread Use of unitialized value in pattern match (m//) (7 answers)
Opened by StefanJ at 2007-11-12 15:14

StefanJ
 2007-11-12 15:14
#102258 #102258
User since
2005-05-03
35 Artikel
BenutzerIn
[default_avatar]
Hi @ all,

ich hoffe ihr könnt mir bei einem kleinen Problem helfen:
ich erhalte immer folgende Fehlermeldung
Use of unitialized value in pattern match (m//) in line .

Der zugehörige Quellcode sieht so aus:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
my $localpath = "c:/apps/Sync/";
my $localpathfiles;
   open(Source, '<', $localpath."localpath.txt")
      or die "Konnte Quelldatei nicht oeffen $!";
      while(<Source>)
      {
        $localpathfiles = $_;
      }
   close(Source);

chomp ($localpathfiles);
$localpathfiles =~ s/\s+$//g;
$localpathfiles =~ s/\\/\//g;

if ($localpathfiles ne~ /\/$/)
{
$localpathfiles = $localpathfiles."\/";
}


Wieso sagt er mir "value uninitialized" wenn $localpathfiles doch einen Wert hat ? (die localpath.txt wird vorher mit einem cmd-skript durch Eingabe mit einem Pfad gefüllt ,z.B. c:\synctest)

Kann mir das einer erklären, ich weiß zwar dass das nur ein Hinweis ist und die Funktionalität nicht beinflusst, aber ich wüsste gerne die Antwort auf dieses Problem :-)

Gruß,

StefanJ

----
Modedit Gwendragon:
bitte Code in Perl- oder-Tags
----

View full thread Use of unitialized value in pattern match (m//)