Do you have any idea what Perl is, and what the shell is? Perl doesn't have "its own shell scripting process" just like it doesn't have "its own Python scripting process" and Java doesn't have "its own Perl scripting process".
There's the language Perl, compiled and run by perl. There's Python, compiled and run by python, jpython and a few more implementations. There are a dozen or more closely related shell dialects, each interpreted and run by a different binary (sh, bash, zsh, ksh, psh, ash, csh, tcsh, etc). | [reply] |
Your description is too vague to be certain, but I guess that you should add a loop to iterate over your data files (I assume you mean data files when you say "data scripts") to the Perl script you have written, rather than writing a separate shell script.
Can you turn your current script into a subroutine and call it once for each data file?
Assuming your "data scripts" are files with extension '.dat' and you put your current script into a subroutine named process_data, maybe you could iterate over your data files with something like:
foreach my $file (glob('*.dat')) {
process_data($file);
}
| [reply] [d/l] |
I've been told that shell scripting is the way forward and that Perl has its own shell scripting process
Who gave you that piece of wisdom? Did he have pointy hair and is your boss?
A shell has two main features: it can be used interactively and it can be used as a programming language. It is called a shell because its purpose was originally just to run external programs - nothing else. Any product that tries to perform two functions has to make compromises, so generally a shell will not compare well against a product which only does one of those tasks - like Perl. If you need that duality of interaction and programming in the same language then use a shell, otherwise use the language you are most comfortable with. | [reply] |
It's unclear to me what precisely you mean by "shell scripting", so sorry if this is off point. If you mean sending an automated series of commands to the system shell, there a a few commands you can use, depending on what you want back. You probably want system, though depending on what precisely you are trying to do, you may want to use exec or backticks instead... | [reply] |
A shell script in as much as a shell script is the combination of a text file containing a set of commands (each of which is individually runnable at the shell prompt) run by an instance of the shell interpreter.
I've always considered a perl script to be a specialization of a shell script in as much as the perl script ...
- only contains perl commands and ...
- uses the perl interpreter to run the script.
The normal way in which a script is made runnable in its' own right is to...
- chmod(1) the script file to give it execute rights c/w ...
- putting #! /usr/bin/sh (the shebang or hash-bang line) at the very top of the file
So, in order to convert your script (after granting execute rights to the script (via chmod +x file), add the following at the very top of your script file:
#! /usr/bin/env perl
Does that help ??
A user level that continues to overstate my experience :-))
| [reply] [d/l] [select] |