By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,245 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,245 IT Pros & Developers. It's quick & easy.

Perl Script on Linux OS

P: 57
Hello all,
I have written a pretty lengthy Perl script using Win32. Now i need to take this same script and run it on a Linux operating system. I'm not familiar with Linux at all, so I've been researching it for a few days. I feel like it's a little over my head. Or am I looking too much into it? Or maybe I'm looking in the wrong places.

Is there a straightforward way to convert this script and run it on Linux? Or can anyone direct me to a site that will explain how to do this?

Thanks,
Terra
Jan 17 '08 #1
Share this Question
Share on Google+
5 Replies


numberwhun
Expert Mod 2.5K+
P: 3,503
Hello all,
I have written a pretty lengthy Perl script using Win32. Now i need to take this same script and run it on a Linux operating system. I'm not familiar with Linux at all, so I've been researching it for a few days. I feel like it's a little over my head. Or am I looking too much into it? Or maybe I'm looking in the wrong places.

Is there a straightforward way to convert this script and run it on Linux? Or can anyone direct me to a site that will explain how to do this?

Thanks,
Terra
The first thing you would need to do is insert the shebang line (the first line in the script on a unix system. It should read:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl 
  2.  
That will tell the system what to use to run the script when it is executed. Next, you need to ensure that all paths reference Unix paths, and not windows. You are on a different OS now.

After that, you need to make sure the script is executable:

Expand|Select|Wrap|Line Numbers
  1. chmod +x <scriptname>
  2.  
and then just run it using:

Expand|Select|Wrap|Line Numbers
  1. ./<scriptname>
  2.  
if you are in the same directory, or use the full path in place of the "./".

Hope that helps.

Regards,

Jeff
Jan 17 '08 #2

P: 57
Yes Jeff! That helps a lot. I'm going to digest what you've said for a while. i may have more questions later.

Thank you!
Terra
Jan 17 '08 #3

numberwhun
Expert Mod 2.5K+
P: 3,503
Yes Jeff! That helps a lot. I'm going to digest what you've said for a while. i may have more questions later.

Thank you!
Terra
No problem Terra! Ask away when you are ready.

Regards,

Jeff
Jan 17 '08 #4

KevinADC
Expert 2.5K+
P: 4,059
Hello all,
I have written a pretty lengthy Perl script using Win32. Now i need to take this same script and run it on a Linux operating system. I'm not familiar with Linux at all, so I've been researching it for a few days. I feel like it's a little over my head. Or am I looking too much into it? Or maybe I'm looking in the wrong places.

Is there a straightforward way to convert this script and run it on Linux? Or can anyone direct me to a site that will explain how to do this?

Thanks,
Terra
If the script is not meant to run exclusively in a Windows environment, but is a sort of general application, then converting should be pretty straight forward and in fact may not require you do anything besides add or change the shebang line.

On the other hand, if you are using Win32 modules the script will need to be modified to work on other operating systems.
Jan 17 '08 #5

P: 57
If the script is not meant to run exclusively in a Windows environment, but is a sort of general application, then converting should be pretty straight forward and in fact may not require you do anything besides add or change the shebang line.

On the other hand, if you are using Win32 modules the script will need to be modified to work on other operating systems.

Yes, I thought about that. in my script i have created GUI windows using Win32::XMLBuilder, so i'm going to have to figure out how to create GUI windows for that operating system.

Terra
Jan 23 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.