[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 152
  • Last Modified:

$variable passing

Hi,
Sorry, it's probably a simple, straight forward question, but one i haven't found the answer to yet.

I'm basically trying to pass six variables created from one script "ORFfinder.pl", to another program "proteindigest.pl". I'd assume it'd be a similar method to passing a variable to a subroutine? if it is at all possible?

Thanks in advance.
0
StephenMcGowan
Asked:
StephenMcGowan
  • 3
  • 3
1 Solution
 
TintinCommented:
How are you calling proteindigest.pl?

0
 
ozoCommented:
Do you get to write proteindigest.pl?
If not, how does it currently like to receive variables?
0
 
StephenMcGowanAuthor Commented:
Hi ozo,

Yeah basically what i'm doing is from the programme i wrote before with the longest dna sequences ($longorf1, $longorf2 etc etc), i'm now trying to pass these to a script "proteindigest.pl" which will then call a sub-routine and convert them from dna to protein sequence before doing some more stuff to the sequences.

If i can't transfer the variables from one script to another i should be ok with creating a sub-routine to carry out the same function. Just not sure if script.pl -> script.pl is possible or not?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
ozoCommented:
if proteindigest.pl starts with
my($var1,$var2,$var3,$var4,$var5,$var6)=@ARGV;

then you can call
system 'proteindigest.pl', $var1,$var2,$var3,$var4,$var5,$var6;
0
 
StephenMcGowanAuthor Commented:
ok, so at the very end of ORFfinder.pl i've put:

system 'proteindigest.pl', $longorf1,$longorf2,$longorf3,$longorf4,$longorf5,$longorf6;

and for proteindigest.pl:

# Initialise variables

my($longorf1,$longorf2,$longorf3,$longorf4,$longorf5,$longorf6)=@ARGV;

but receive the error message:

Can't exec "proteindigest.pl": No such file or directory at ORFfinder.pl line 77.

is there a way of telling it to automatically look in the same directory, if both scripts are in the same directory?
0
 
ozoCommented:
'./proteindigest.pl'
if proteindigest.pl is in the current working directory.
how was ORFfinder.pl invoked?
0
 
StephenMcGowanAuthor Commented:
Thanks ozo,

It's worked a charm.. I had it as ./'proteindigest.pl'; with ./ outside the quotations.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now