I have two scripts: per4.pl - @food = ("pear", "plum", "egg", "apple");
-
$TableLength = $#food;
-
print $TableLength;
-
for($i = 0; $i < $TableLength; ++$i){
-
print "$food[$i]\n";
-
}
-
do{
-
print "Password?";
-
$a = <STDIN>;
-
chop $a;
-
}
-
while ($a ne "fred");
The other perl5.pl - $FileName = "perl4.pl";
-
system $FileName;
-
-
while($Line ne "Password?"){
-
$Line = <STDIN>;
-
if($Line eq "Password?"){
-
print STDOUT "fred"
-
}
-
chop $Line;
-
}
My intention is that when I got question about password from perl4 perl5 should set that and both should finish. Can anybody help me with this task??
Regards
krieger
2 1062
If you want to perl4.pl to take password from perl5.pl, then you should call perl5.pl within perl4.pl rather than calling perl4.pl from perl5.pl.
You have tried to capture line containing "Password" and pass "fred" to STDOUT, though it is incorrect. The actual flow is that system command will be executed first(perl4.pl will execute first) before getting to while loop.
I would suggest you to try the following script if your objective is just to set password from perl5.pl perl4.pl -
$FileName = "perl5.pl";
-
-
@food = ("pear", "plum", "egg", "apple");
-
$TableLength = $#food;
-
print $TableLength;
-
for($i = 0; $i < $TableLength; ++$i){
-
print "$food[$i]\n";
-
}
-
do{
-
print "Password?\n";
-
$a = `perl $FileName`; # get the output from perl5.pl
-
$a eq "fred" or $a=<STDIN>; ## take STDIN if $a is not "fred"
-
chomp $a;
-
-
}
-
while ($a ne "fred");
-
perl5.pl -
print "fred"; ##pass "fred" or write your code
-
I am using reverse quote instead of system command because, system() will return 0 if the command executed or null if it fails.
If you want to perl4.pl to take password from perl5.pl, then you should call perl5.pl within perl4.pl rather than calling perl4.pl from perl5.pl.
You have tried to capture line containing "Password" and pass "fred" to STDOUT, though it is incorrect. The actual flow is that system command will be executed first(perl4.pl will execute first) before getting to while loop.
I would suggest you to try the following script if your objective is just to set password from perl5.pl perl4.pl -
$FileName = "perl5.pl";
-
-
@food = ("pear", "plum", "egg", "apple");
-
$TableLength = $#food;
-
print $TableLength;
-
for($i = 0; $i < $TableLength; ++$i){
-
print "$food[$i]\n";
-
}
-
do{
-
print "Password?\n";
-
$a = `perl $FileName`; # get the output from perl5.pl
-
$a eq "fred" or $a=<STDIN>; ## take STDIN if $a is not "fred"
-
chomp $a;
-
-
}
-
while ($a ne "fred");
-
perl5.pl -
print "fred"; ##pass "fred" or write your code
-
I am using reverse quote instead of system command because, system() will return 0 if the command executed or null if it fails.
Hi
The problem is that I will have more interaction between perl5 and perl4, I gave those files only as example. I need to execute perl4 from perl5. In real scripts I cannot change perl4, it is built in a System.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Mircea Pleteriu |
last post by:
Hi all,
I have created a .NET Windows control with c#.
I have placed the control on a HTML page within the OBJECT element.
Everything works fine up to now.
Now, I wanna implement the following stuff that the control must support.
The control must provide a method called InvokeJavaScriptFunction
The prototype of this method is:
|
by: trinitypete |
last post by:
Hi all,
I have a user control that uses control literal to build
a heading with a link, and a div containing links below.
As the link heading is hit, I want to change the style of
the div, making it visible or not. Yep you guessed it,
expanding tree type functionality.
The header has an onclick event onclick='Doexpandcollapse
|
by: Ron Vecchi |
last post by:
Hello,
Through using this and many other Microsoft dotnet newsgroups I have been
pointed towards many helpful open source projects and articles that have
helped a great deal in my studies as well as projects.
Recently I have been using a lot of Macromedia Flash Movies within my
asp.net pages, as many people have.
For those familiar with Flash macromedia can publish the html output for you
so you only need to copy/paste to your...
|
by: moondaddy |
last post by:
I have a user control being used instead of a frame page. when the user
clicks on a menu item I need to send the ID (integer value) of that menu as
a parameter in the postback of the user control which will be used to query
sql server to repopulate the datagrid in the user control.
I also wrapped the user control in a panel element so I could position it on
the page.
I'm clueless on how to get started with this.
|
by: Selden McCabe |
last post by:
I have a form with a bunch of image buttons. When the user moves the mouse
over a button, I want to do two things: 1. change the Imagebutton's picture,
and 2. make another control visible.
I'm using the Imagebutton.Attributes.Add("onMouseOver","this.src =
'somepicture.jpg')
and that works fine.
I've tried some java script to change the other control's visible property
by changing is className, but that doesn't seem to work
| |
by: Nathan |
last post by:
I have an aspx page with a data grid, some textboxes, and an update button.
This page also has one html input element with type=file (not inside the data
grid and runat=server).
The update button will verify the information that has been entered and
updates the data base if the data is correct. Update will throw an exception
if the data is not validate based on some given rules. I also have a custom
error handling page to show the...
|
by: serge calderara |
last post by:
Dear all,
I am new in asp.net and prepare myself for exam
I still have dificulties to understand the difference between server control
and HTML control.
Okey things whcih are clear are the fact that for server control component ,
code is running on the server side.
But if I take as example a Label. I place on a webform an HTM label control
and a WebForm label control, I could see that properties are different for
|
by: Hans Merkl |
last post by:
Hi,
Can anybody recommend a combo box control (textfield + dropdown list) for
ASP.NET?
I have looked at some products and it seems they all have some problems. I
haven't yet found a combo box control that works on IE, Firefox and Opera.
I am open to commercial and open source projects.
|
by: avp |
last post by:
Hi,
We have an ASP.NET 2.0 (C#) application that has a web form with a
CheckBoxList control and a CustomValidator control. The CustomValidator
control is used to validate that at least one checkbox is checked in the
CheckBoxList control.
Everything works fine for the server-side validation. However, we're having
difficulties with writing a JavaScript function to perform the same
validation on the client-side.
|
by: rn5a |
last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with
the IDs 'txt1' & 'txt2' respectively. To use this user control in an
ASPX page, the following Register directive will be required:
<%@ Register TagPrefix="UC" TagName="MyUserCtrl" Src="MyUC.ascx" %>
Assuming that the ASPX page doesn't use a code-behind, I can access the
properties, events etc. of the user control in the ASPX page in this
way (assume that the ASPX page...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |