LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-18-2003, 10:02 AM   #1
nbp
LQ Newbie
 
Registered: Oct 2003
Posts: 9

Rep: Reputation: 0
Perl


consider two scripts exp.pl and 1.pl

exp.pl :

#!/usr/bin/perl
$qwerty="hello";
`perl 1.pl`;

1.pl :

#!/usr/bin/perl
print $qwerty;

When I run exp.pl, the variable isn't printed. Please explain why. Also tell what must be done so that the variable is printed.
 
Old 11-18-2003, 10:05 AM   #2
SaTaN
Member
 
Registered: Aug 2003
Location: Suprisingly in Heaven
Posts: 223

Rep: Reputation: 33
Well maybe one way of doing it is to write the value of $qwerty on to a file.
Then read that file in the other program
 
Old 11-18-2003, 11:07 AM   #3
paonethestar
Member
 
Registered: Oct 2003
Posts: 47

Rep: Reputation: 16
If the file content is too large mean contain some 20,000 lines or more , how much time it will take to read or for search ??

Last edited by paonethestar; 11-18-2003 at 11:08 AM.
 
Old 11-18-2003, 11:12 AM   #4
SaTaN
Member
 
Registered: Aug 2003
Location: Suprisingly in Heaven
Posts: 223

Rep: Reputation: 33
Quote:
Originally posted by paonethestar
If the file content is too large mean contain some 20,000 lines or more , how much time it will take to read or for search ??
I don't understand what you are talking about ....
Any way it was nbp's question and looks like you are trying to imagine a bit too much .

Maybe nbp should be a bit more clear about it
 
Old 11-25-2003, 02:46 PM   #5
jovo
LQ Newbie
 
Registered: Jul 2003
Location: Amersfoort Netherlands
Distribution: SuSe 8.1
Posts: 8

Rep: Reputation: 0
You just runs another instance of perl. It does not know anything about variables
in the calling script.

If you replace
`perl 1.pl`

by

do "1.pl";

the variable is found and printed.
 
Old 11-26-2003, 01:27 AM   #6
nbp
LQ Newbie
 
Registered: Oct 2003
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks Jovo

Found your suggestion very helpful. Can you please tell us how to use "do" if we are redirecting. The situation is

do "1.pl"

and in 1.pl, we have $word=<STDIN>;

I would like to redirect the content of 1.txt to 1.pl.
How can I do it?

Last edited by nbp; 11-26-2003 at 03:23 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with perl module for w3c validator to work on my local Apache+PHP+perl instal tbamt Linux - Software 0 12-16-2004 05:37 PM
cgi perl : I cant get perl to append my html file... the_y_man Programming 3 03-22-2004 05:07 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM
chrooting apache v2 (php, ssl, perl support) ; perl configuration markus1982 Linux - Security 3 01-26-2003 06:15 PM
can i set ~/public_html/perl as a perl directory for apache? doublefailure Linux - Networking 1 07-09-2002 04:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration