Hi
anyone can help how put the directory in array in perl.eg directory paths below:-
/home/user/
/home/admin/
/var/log/
IF path eq /home/user/ then the files moved to /data/user/
IF path eq /var/log/ then the files moved to /data/log/
Thanks
Hi
anyone can help how put the directory in array in perl.eg directory paths below:-
/home/user/
/home/admin/
/var/log/
IF path eq /home/user/ then the files moved to /data/user/
IF path eq /var/log/ then the files moved to /data/log/
Thanks
Unable to understand exactly
Is this you are looking for ?
@array = (
"/home/user/",
"/home/admin/",
"/var/log/",
);
foreach(@array) {
if ( $_ eq "/home/user/" ) {
# do required with /home/user
print "user\n";
} elsif ( $_ eq "/var/log/" ) {
# do required
print "log\n";
}
}