Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Im am using perl on windows for the first time and trying to write a tk gui that includes images. When i run the gui it says unable to locate image. the gui runs fine when i take the image out of the gui. is their a special way to specify a path in windows? Thanks for any help. Here is my syntax:
my $image = "C:\image\image.xpm"; my $image1 = $mw->Pixmap(-file => $image);

Replies are listed 'Best First'.
Re: perl windows xp newbie
by mwah (Hermit) on Oct 27, 2007 at 23:11 UTC
    is their a special way to specify a path in windows?

    Yes, there are some

    • (1) use the forward slash: "C:/image/image.xpm"
    • (2) escape backslash by backslash: "C:\\image\\image.xpm"
    • (3) use single quotes (no interpolation): 'C:\image\image.xpm'
    • see perldoc perlport: [Files and Filesystems]

    The (1) option should be fine with TK.

    Regards

    mwa

Re: perl windows xp newbie
by Anonymous Monk on Oct 27, 2007 at 23:20 UTC
    So simple (1) option worked. thanks.
Re: perl windows xp newbie
by Jenda (Abbot) on Oct 28, 2007 at 17:51 UTC

    The very first thing you should do if Perl reports that something that should exist doesn't is to make sure that the variable(s) contain what you think they do. In this particular case you'd find out that the $image is "C:imageimage.xpm", most likely not what you expected, right? Don't ask right away, debug!