running perl script problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting running perl script problem
# 1  
Old 01-21-2010
running perl script problem

While executing perl scriptit gives some compling issue, please help out

Code:
$inputFilename="c:\allways.pl";
open (FILEH,$inputFilename) or die "Could not open log file";
 
Error : Could not open log file at c:\allways.pl line 4

learner in Perl

Last edited by pludi; 01-21-2010 at 12:25 PM.. Reason: code tags, please...
# 2  
Old 01-21-2010
When using double quotes, you have to use a backslash to escape another backslash if it's to be taken literally. The reason is that with double quotes, all kinds of stuff get interpolated, eg. you can use "\n" for a newline, "\t" for a tab, ...

2 ways to solve this:
  • write "c:\\allways.pl"
  • write "c:/allways.pl"
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl script running multiple commands at once

Hi All, I have put a perl script together to go and collect some information from multiple nodes/endpoints. The script works absolutly fine however I want to make it quicker. You will see in the below that my script calls an expect script called ssh_run_cmd2.exp followed by the IP of... (7 Replies)
Discussion started by: mutley2202
7 Replies

2. Windows & DOS: Issues & Discussions

PERL: Running script from Notepad++

I'm not sure if this forum covers PERL issues but here I go: I'm trying to run a PERL script from Notepadd++. I've entered the path of the script from the run command but it is only opening a blank window. Is there anything else that needs to be done when using the 'RUN' feature of Notepad++? (2 Replies)
Discussion started by: millsy5
2 Replies

3. Shell Programming and Scripting

Running one Perl script from another

Hi, I have one small question - what is the best way to run one perl script from another? Thanks in advance. (1 Reply)
Discussion started by: xqwzts
1 Replies

4. UNIX for Advanced & Expert Users

What script is running by Perl?

Dear fellow unixoids! I need a little help (just a link would be fine) how can I investigate what specific perl script is eating 100% of cpu of my ubuntu server: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND ... (2 Replies)
Discussion started by: ulrith
2 Replies

5. Shell Programming and Scripting

Problem running Perl Script with huge data files

Hello Everyone, I have a perl script that reads two types of data files (txt and XML). These data files are huge and large in number. I am using something like this : foreach my $t (@text) { open TEXT, $t or die "Cannot open $t for reading: $!\n"; while(my $line=<TEXT>){ ... (4 Replies)
Discussion started by: ad23
4 Replies

6. Shell Programming and Scripting

Running unix commands in a perl script

Executing two unix commads via perl script one after another e.g: make clean bsub -i -q short make have tried using exec but the second command doesnt executes (1 Reply)
Discussion started by: rajroshan
1 Replies

7. Shell Programming and Scripting

running shell command in Perl script

Does not work. #!/usr/bin/perl $etcdir = 'ls -l /etc'; print $etcdir; #END ------------result-------- #perl -w abc123.pl ls -l /etc # This method works. #!/usr/bin/perl $etcdir = system("ls -l /etc"); print $etcdir; #END (2 Replies)
Discussion started by: dplinux
2 Replies

8. Shell Programming and Scripting

running egrep in perl script ?

Hi there if i run this from the BASH command line, i get a good result # FS="my-box23/account" # zfs list -t filesystem -H | cut -f1 |egrep "^ZPpool1/$FS$" ZP0pool1/my-box23/account which is great, however if I try to run in a perl script populating an array with the result/s, i get... (4 Replies)
Discussion started by: rethink
4 Replies

9. Shell Programming and Scripting

Problems in running a Perl script via cronjob

I have a very basic perl script that attempts to find if a process is running. If the process is not running then the script is supposed to start the process. If I execute the script from command line it works fine as expected. However if the script is executed via cronjob, the script cannot find... (1 Reply)
Discussion started by: ypant
1 Replies

10. UNIX for Dummies Questions & Answers

running a Perl script on HPUX platform

Hi, I wish to execute a simple perl script to pass unix commands on a HPUX platform, retrieve the result and filter through the text to determine outcomes x,y and z. I am developing the code on my windows system. I initially wrote the code to issue UNIX commands line by line, however i soon... (1 Reply)
Discussion started by: mmetcalfe
1 Replies
Login or Register to Ask a Question