Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of uninitialized value ??

Status
Not open for further replies.

NavMen

Vendor
Jul 6, 2004
35
NL
Hi,

When I run this Perl script from an other directory then the C:\EVAL it will shortcut all the files in the C:\EVAL directory (not checking the last access time). Running the Perl Script in the C:\EVAL directory everything works fine.

I got the error “Use of uninitialized value in concatenation (.) or string at Archive_SRC.pl line 58. When I run the script form an other directory.

What is wrong with my script..

All help is welcome.

Thnx
Navmen.


#!/usr/local/bin/perl -w
use strict;
use Errno;
use Getopt::Std;
#use Win32::TieRegistry ( Delimiter=>"/", ArrayValues=>1 );
use Win32::ODBC;
use Time::Local;
use Win32::Shortcut;

my $SHARE = "\\\\SERVER\\SHARE";
my $DESCRIPTION = "Shortcut created by Perl";
my $dir = "EVAL";
my $drv = "C:\\";
my $dir1 = "C:\\EVAL\\";

my $now = time;
my $secs = 60;
my $file = "";
my @a = stat($file);
my $new = "$SHARE\\$dir\\$file";

------------------------------------------\n");

opendir (DIR, $dir1);
my @allfiles = readdir DIR;
closedir DIR;

foreach my $file (@allfiles) {
if ( $file eq "." or $file eq ".." or $file eq ".lnk") {
next;
}
{
my @a = stat($file);

if ($now - $a[8] > $secs){
print " \n";
print "File: $dir1$file. \n";
print "Perm: $a[2] \n";
print "File Size: $a[7] Bytes.\n";
print "Time: $now.\n";
print "Last Access Time: $a[8].\n";
print "Last Modify Time: $a[9].\n";
require Win32::Shortcut;
import Win32::Shortcut;

my $RET = 0;
my $LINK = new Win32::Shortcut("$dir1$file.lnk");
$LINK ->{'Path'} = "$SHARE\\$dir\\$file";
$LINK ->{'Description'} = $DESCRIPTION;


if ( $LINK -> Save() )
{
$RET = 0;
}
else
{
print "%dds_msg_noh%Can not find link file - $dir1$file.lnk\n";
$RET = 1;
}
#
}
}
}



 
you're script appears to have a syntax error here:

------------------------------------------\n");

maybe that should be:

print "------------------------------------------\n";

or maybe it should be:

#------------------------------------------

not really sure why it's there. Fix that line and retry your script.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top