Sponsored Content
Top Forums Shell Programming and Scripting PERL - Variable values getting mixed up! Post 302819053 by chris01010 on Monday 10th of June 2013 07:32:51 AM
Old 06-10-2013
PERL - Variable values getting mixed up!

Hi,

I only dip my toe into PERL programming on the odd ocassion so I was wondering if anyone had any ideas as to why the below is happening:
When I run my PERL script the variable values seem to get mixed up.

Code:
my $fileName = basename($maxFile,".TXT");
my $currentSeqNum = substr($fileName,-1,1);
my $nextSeqNum = ($currentSeqNum)++;
print "File Name: $fileName\n\n";
print "Current Sequence Num: $currentSeqNum\n\n";
print "Next Sequence Num: $nextSeqNum\n\n";

Which produces:

Code:
MaxFile: FOT05172.TXT
File Name: FOT05172
Current Sequence Num: 3
Next Sequence Num: 2

$maxFile gets it value from an sql query using DBI which is correct. The problem lies in the fact that the "Current Sequence Num:" and "Next Sequence Num:" values seem to be the wrong way round.
Can anyone spot a mistake in my code?

Thanks
Chris
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

getting values from variable in a loop

I have a set of variables: f1="./someFolder" . . f10="./someOtherFolder" And I'm trying to use the following loop for (( i = 0; i <= 10; i++ )) do temp=f$i done I'm trying the get the values from my set of variable to make directories, but I can't seem the get those value... (3 Replies)
Discussion started by: kriuz
3 Replies

2. Linux

How to store values into variable in perl

Hi, Can you please help me of how to store the values into variables. Here is the output in LINUX for the below command. $free output : total used free Mem: 3079276 3059328 19948 Swap: 1023992 6324 1017668 ... (3 Replies)
Discussion started by: chittiprasad15
3 Replies

3. Shell Programming and Scripting

perl -write values in a file to @array in perl

Hi can anyone suggest me how to write a file containing values,... say 19 20 21 22 .. 40 to an array @array = (19, 20, ... 40) -- Thanks (27 Replies)
Discussion started by: meghana
27 Replies

4. Shell Programming and Scripting

Reading variable from file variable values

Hi, Here is the output of lpstat. I would like to read value of Queue which is(abxxxxb1)and status that is DOWN in first line. i dont care what is in second line. any one can help me.thanks Queue Dev Status Job Files User PP % Blks Cp Rnk ------- ----- ---------... (5 Replies)
Discussion started by: sagii
5 Replies

5. Shell Programming and Scripting

substitute variable for values in perl

hi all, how do i assign values passed in from command line to and sql statement in perl ?? e.g i want to assign :name1 and :Name2 to be whatever is passed into the perl script command line my $sqlStr = "select * from test_table where column1 = upper(nvl(:name1, name1 )) and column2... (1 Reply)
Discussion started by: cesarNZ
1 Replies

6. UNIX for Dummies Questions & Answers

Variable is not substituting values

Hi All, OS HPUX 11.11 I am using following script to take controlfile backup. I have used SID variable to hold "ffin1" value, which I again subsitute in "'/db/ffin1/home/oraffin1/$SID_$wdate.ctl'" command. Well, after running this, SID variable does not subsittue it's value, while wdate... (6 Replies)
Discussion started by: alok.behria
6 Replies

7. Shell Programming and Scripting

Extract values from Perl variable

Hi Guys, I am stuck in a problem. I have a variable in Perl script which has value for example X=a-b-c; Now, I want to extract a b c separately into different 3 variables. I know this can be done in shell using awk but Perl behaves a bit different. Can anybody help me on this please?... (3 Replies)
Discussion started by: prashant2507198
3 Replies

8. Shell Programming and Scripting

Perl help - how to assign output of perl to variable

Hi, guys, i have a script i inherited from a coworker but i'm not perl savy. The script works but i would like it to work better. I want to run this command ./ciscomgrtest.pl -r "show version" -h hosts.router and have the script goto each router in the hosts.router file and run the command... (2 Replies)
Discussion started by: whipuras
2 Replies

9. Shell Programming and Scripting

Filtering values in variable

Hi, is there a faster/simpler way to filter values from the variable1 in variable2? example: variable1="A|B|C|E" variable2="A|B|C|D|F" output: "A|B|C" Thanks, zzavilz (4 Replies)
Discussion started by: zzavilz
4 Replies

10. Shell Programming and Scripting

Perl :: reading values from Data Dumper reference in Perl

Hi all, I have written a perl code and stored the data into Data structure using Data::Dumper module. But not sure how to retreive the data from the Data::Dumper. Eg. Based on the key value( Here CRYPTO-6-IKMP_MODE_FAILURE I should be able to access the internal hash elements(keys) ... (1 Reply)
Discussion started by: scriptscript
1 Replies
PERLVOS(1)						 Perl Programmers Reference Guide						PERLVOS(1)

NAME
perlvos - Perl for Stratus OpenVOS SYNOPSIS
This file contains notes for building perl on the Stratus OpenVOS operating system. Perl is a scripting or macro language that is popular on many systems. See perlbook for a number of good books on Perl. These are instructions for building Perl from source. This version of Perl requires the dynamic linking support that is found in OpenVOS Release 17.1 and thus is not supported on OpenVOS Release 17.0 or earlier releases. If you are running VOS Release 14.4.1 or later, you can obtain a pre-compiled, supported copy of perl by purchasing the GNU Tools product from Stratus Technologies. BUILDING PERL FOR OPENVOS
To build perl from its source code on the Stratus V Series platform you must have OpenVOS Release 17.1.0 or later, GNU Tools Release 3.5 or later, and the C/POSIX Runtime Libraries. Follow the normal instructions for building perl; e.g, enter bash, run the Configure script, then use "gmake" to build perl. INSTALLING PERL IN OPENVOS
1. After you have built perl using the Configure script, ensure that you have modify and default write permission to ">system>ported" and all subdirectories. Then type gmake install 2. While there are currently no architecture-specific extensions or modules distributed with perl, the following directories can be used to hold such files (replace the string VERSION by the appropriate version number): >system>ported>lib>perl5>VERSION>i786 3. Site-specific perl extensions and modules can be installed in one of two places. Put architecture-independent files into: >system>ported>lib>perl5>site_perl>VERSION Put site-specific architecture-dependent files into one of the following directories: >system>ported>lib>perl5>site_perl>VERSION>i786 4. You can examine the @INC variable from within a perl program to see the order in which Perl searches these directories. USING PERL IN OPENVOS
Restrictions of Perl on OpenVOS This port of Perl version 5 prefers Unix-style, slash-separated pathnames over OpenVOS-style greater-than-separated pathnames. OpenVOS- style pathnames should work in most contexts, but if you have trouble, replace all greater-than characters by slash characters. Because the slash character is used as a pathname delimiter, Perl cannot process OpenVOS pathnames containing a slash character in a directory or file name; these must be renamed. This port of Perl also uses Unix-epoch date values internally. As long as you are dealing with ASCII character string representations of dates, this should not be an issue. The supported epoch is January 1, 1980 to January 17, 2038. See the file pod/perlport.pod for more information about the OpenVOS port of Perl. TEST STATUS
A number of the perl self-tests fails for various reasons; generally these are minor and due to subtle differences between common POSIX- based environments and the OpenVOS POSIX environment. Ensure that you conduct sufficient testing of your code to guarantee that it works properly in the OpenVOS environment. SUPPORT STATUS
I'm offering this port "as is". You can ask me questions, but I can't guarantee I'll be able to answer them. There are some excellent books available on the Perl language; consult a book seller. If you want a supported version of perl for OpenVOS, purchase the OpenVOS GNU Tools product from Stratus Technologies, along with a support contract (or from anyone else who will sell you support). AUTHOR
Paul Green (Paul.Green@stratus.com) LAST UPDATE
February 28, 2013 perl v5.18.2 2013-11-04 PERLVOS(1)
All times are GMT -4. The time now is 12:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy