hi , i am pretty new to perl and I have a quick question.
below the code won't work unless fileName is under the same directory. would any one please give a quick reference in how to specify the full address of the file? such as /home/myName/fileName

#!/usr/bin/perl
cat fileName;

thanks

#!/usr/bin/perl
system("cat '/something/something/something/darkside.txt'");
#!/usr/bin/perl
system("cat '/something/something/something/darkside.txt'");

thanks and may i also ask how to assign the value to a variable?

i tried

$var = system("cat '/root/file' | wc -l"); 
print "$var"

it somehow returns 0 which is not right.
what is the proper way? thanks

#!/usr/bin/perl

$filename = "/root/file";
$var = `cat $filename | wc -l`;

print "$var";

EDIT: you shouldn't be stomping around a system as root.

thanks it worked. sorry i forgot to mark it solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.