Sponsored Content
Top Forums Shell Programming and Scripting perl scalar variable in backquoted string Post 302139335 by mehdi9 on Friday 5th of October 2007 11:44:53 AM
Old 10-05-2007
ok my real work does not involve wildcard or anything, the following is what I am doing:

I am making webpage using cgi, I have a popup menu named "add" and in the menu it has a list of filenames.

In each of these files that are listed, there is another list containing information on a network. These files are updated daily.

so I made a submit button, when it is pressed; right next to it a new popup menu appears. The contents in the popup menu is the list of network data stored in file that was first selected on the "add" popup menu.

So my biggest dellima is to find out what filename was selected in the add popup menu. Than I want to use the filename, put it into a directory format than access it and using pg for example I would gather all the network information. From there I put the network information in an array and refrence it to the new popup menu under the -value item.

So right now this is something similar to what I am doing:

Code:
sub getValues {

$myvar2 = param('add');

`ls -l >> $tempfile`;
`pg  $myvar2 >> $tempfile`;
`echo hello there >> $tempfile`;

open(ADDLIST, "<tempfile");
@addvar = (" ", <ADDLIST>, $myvar2);
unlink("$tempfile");

return popup_menu(-name=>'add2',-values=>\@addvar,-default=>'');

}

when I run the code I would be able to see the following values in the new popup menu:

the contents of ls -l
hello there
the value of $myvar2

however I can not see the list from $myvar2 itself. I do not understand why this is.

I also tried to explicitly state a filename instead of $myvar2 and it works perfectly well. Looking forward to your solutions, and many thanks again.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Query string assingment for other variable in PERL

Hi friends, I want to use query string value to another variable but it gives following error when I use it with print out command, Insecure dependency in open while running with -T switch at C:/Program Files/Apache Group/Apache2/cgi-bin/cdr_findere.pl line 119. My code as follows, my... (0 Replies)
Discussion started by: maheshsri
0 Replies

2. Shell Programming and Scripting

Can't modify not in scalar assignment compilation error

My perl code is below. Its just a simple assignment and printing out of the value. $match = "my name is"; print "printing $match\n" ; Does anyone know where is the error? (2 Replies)
Discussion started by: new2ss
2 Replies

3. Shell Programming and Scripting

scalar variable assignment in perl + { operator

When reading over some perl code in a software document, I came across an assignment statement like this $PATH = ${PROJECT}/......./.... In this particular form of scalar variable assignment, what does the curly braces operators do ? Also, what is the benefit in doing scalar assignment this... (3 Replies)
Discussion started by: JamesGoh
3 Replies

4. UNIX for Advanced & Expert Users

Scalar i500 can see tape drives but not autochanger

We have a new i500 and have 4 TLO4 drives which are connected directly to 2 FC cards on the host. The host can communicate with the autochanger through whichever drive that is set as control path. When I run inquire, all 4 drives are listed but auto changer doesn't show up. Does anyone know... (1 Reply)
Discussion started by: tecky
1 Replies

5. Shell Programming and Scripting

perl DBI: populate a scalar from a select statement

hi every resource i see regarding DBI refers to retrieving data from a database into and array or a hash, but i havent seen anything on how to pull out a single value to a scalar in my database i have a field called "forcewrite" with a value of "6". I am trying to connect to the database,... (2 Replies)
Discussion started by: hcclnoodles
2 Replies

6. Shell Programming and Scripting

Problem with KSH script using scalar variable

Hi Guys, I'm having a hard time bringing out my desired output from my korn shell script. This particular statement from my script its seems not working perl -ne 'print if $_ lt ${date1}' . My complete script as shown below. Please help. Code: #!/usr/bin/ksh ... (5 Replies)
Discussion started by: victorneri
5 Replies

7. Shell Programming and Scripting

String variable to numeric conversion in perl

Hi guys I am having this strange issue.Well my requirement is like below Compare two values between flat file and oracle DB Via perl script I am easily getting the rowcount Now I connect sql plus via perl and the column value that returns is string my $sqlplus_settings = ''; my... (7 Replies)
Discussion started by: Pratik4891
7 Replies

8. Shell Programming and Scripting

PERL : pattern matching a string stored in a variable

I have two variables, my $filename = "abc_yyyy_mm_dd.txt"; my $filename1 = " abc_2011_11_07.txt"; I need to perform some operations after checking if $filename has $filename1 in it i have used the below code, if($filename =~ /^$filename1/) { ---- -- } (2 Replies)
Discussion started by: irudayaraj
2 Replies

9. Shell Programming and Scripting

Perl : converting file to different scalar elements

I have a text file containing 2 exec statements as below and trying to store the below 2 execs into 2 different scalar variables in perl. /* ICD Dist, Total */ /* need to export to Excel, sheet=ICD_Dist__Total */ exec( 'select sum(count(*)) cast(count(*)*100.0/sum(count(*)) over() as... (7 Replies)
Discussion started by: scriptscript
7 Replies

10. UNIX for Beginners Questions & Answers

Check if string variable is a subset of another string variable

Below is my ksh shell script where I need to check if variable fileprops is a subset of $1 argument. echo "FILE PROPERTY: $fileprops" echo "PARAMETER3: $1" if ; then echo "We are Good. $line FILE is found to be INTACT !! " else echo... (2 Replies)
Discussion started by: mohtashims
2 Replies
TIX(3)							       Tix Built-In Commands							    TIX(3)

NAME
tixPopupMenu - Create and manipulate tixPopupMenu widgets SYNOPSIS
tixPopupMenu pathName ?options? SUPER-CLASS The tixPopupMenu class is derived from the TixShell class and inherits all the commands, options and subwidgets of its super-class. STANDARD OPTIONS
The PopupMenu widget supports all the standard options of a frame widget. See the options(n) manual entry for details on the standard options. WIDGET-SPECIFIC OPTIONS [-buttons buttons] A Tcl list that specifies the mouse button(s) and key modifier(s) that bring up the popup menu. Each element of this list is in turn a list that contains two elements: the first element is an integer that indicates the mouse button that brings up the popup menu; the second element specifies the key modifiers that should be used in conjunction with the mouse button. For example, the value {{1 {Control Meta}} {3 {Any}}} specifies that the popup menu can be popped up by (a) pressing mouse button 1 with either the Control or the Meta key or (b) pressing mouse button 3 with any key modifier. The default value is {{3 {Any}}}: only mouse button 3 brings up the popup menu. [-postcmd postCmd] Specifies a command to be evaluated just before the menu is about to pop-up. This command is called with two default arguments: the root x-y coordinates where the user has pressed the mouse button. This command must return a boolean value: a false indicates that the menu shouldn't be popped up at this point; a true indicates that the menu should be popped up. This option can be used to find out where the user has pressed the mouse-button and optionally disable the popup menu over certain screen areas. [-spring spring] When set to true, the menu will be automatically popped down if the user releases the mouse button outside of the menu and no menu commands will be invoked. This makes it easy for the user to cancel the popup menu without pressing the Escape key. The default value is true. [-state state] Must be either disabled or normal. The PopupMenu widget will not pop up unless its -state is set to normal. [-title title] Specifies a text string to display inside the menubutton subwidget, as the title of this PopupMenu. SUBWIDGETS
Name: menu Class: Menu The menu subwidget. Name: menubutton Class: Menubutton The menubutton subwidget. DESCRIPTION
The tixPopupMenu command creates a new window (given by the pathName argument) and makes it into a PopupMenu widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the PopupMenu widget such as its cursor and relief. The Tix PopupMenu widget can be used as a replacement of the tk_popup command. The advantage of the Tix PopupMenu widget is it requires less application code to manipulate. Also, it provides a title for the popup menu, which is not available from tk_popup. WIDGET COMMANDS
The tixPopupMenu command creates a new Tcl command whose name is the same as the path name of the PopupMenu widget's window. This command may be used to invoke various operations on the widget. It has the following general form: pathName option ?arg arg ...? PathName is the name of the command, which is the same as the PopupMenu widget's path name. Option and the args determine the exact behav- ior of the command. The following commands are possible for PopupMenu widgets: pathName bind widget ?widget ...? Binds this PopupMenu to one or more widgets. The PopupMenu will be activated when the user presses the right mouse button over these widgets. pathName cget option Returns the current value of the configuration option given by option. Option may have any of the values accepted by the tixPopup- Menu command. pathName configure ?option? ?value option value ...? Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the tixPopupMenu command. pathName post widget x y Posts the PopupMenu inside the widget at the coordinate x,y. pathName unbind widget ?widget ...? Cancels the PopupMenu's binding with the widget(s). pathName subwidget name ?args? When no options are given, this command returns the pathname of the subwidget of the specified name. When options are given, the widget command of the specified subwidget will be called with these options. KEYWORDS
Tix(n) Tix 4.0 TIX(3)
All times are GMT -4. The time now is 12:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy