Sponsored Content
Top Forums Shell Programming and Scripting perl scalar variable in backquoted string Post 302139343 by ghostdog74 on Friday 5th of October 2007 12:30:45 PM
Old 10-05-2007
i suggest you use perl's native method of listing files eg readdir(), opendir()...instead of calling external shell commands. You can use format to format your output. For more info: perldoc -f opendir, perldoc -f readdir , perldoc -f format
 

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
DIRECTORY(3)						     Library Functions Manual						      DIRECTORY(3)

NAME
opendir, readdir, telldir, seekdir, rewinddir, closedir - directory operations SYNOPSIS
#include <sys/types.h> #include <sys/dir.h> DIR *opendir(filename) char *filename; struct direct *readdir(dirp) DIR *dirp; long telldir(dirp) DIR *dirp; seekdir(dirp, loc) DIR *dirp; long loc; rewinddir(dirp) DIR *dirp; closedir(dirp) DIR *dirp; DESCRIPTION
Opendir opens the directory named by filename and associates a directory stream with it. Opendir returns a pointer to be used to identify the directory stream in subsequent operations. The pointer NULL is returned if filename cannot be accessed, or if it cannot malloc(3) enough memory to hold the whole thing. Readdir returns a pointer to the next directory entry. It returns NULL upon reaching the end of the directory or detecting an invalid seekdir operation. Telldir returns the current location associated with the named directory stream. Seekdir sets the position of the next readdir operation on the directory stream. The new position reverts to the one associated with the directory stream when the telldir operation was performed. Values returned by telldir are good only for the lifetime of the DIR pointer from which they are derived. If the directory is closed and then reopened, the telldir value may be invalidated due to undetected direc- tory compaction. It is safe to use a previous telldir value immediately after a call to opendir and before any calls to readdir. Rewinddir resets the position of the named directory stream to the beginning of the directory. Closedir closes the named directory stream and frees the structure associated with the DIR pointer. Sample code which searchs a directory for entry ``name'' is: len = strlen(name); dirp = opendir("."); for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) if (dp->d_namlen == len && !strcmp(dp->d_name, name)) { closedir(dirp); return FOUND; } closedir(dirp); return NOT_FOUND; SEE ALSO
open(2), close(2), read(2), lseek(2), dir(5) 4.2 Berkeley Distribution September 24, 1985 DIRECTORY(3)
All times are GMT -4. The time now is 10:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy