Sponsored Content
Top Forums Programming Just a short question in Perl Post 302975464 by Don Cragun on Monday 13th of June 2016 02:51:50 PM
Old 06-13-2016
I don't know a lot of perl, but doesn't an else require a preceding if?

Why are you using for loops? Wouldn't a single if statement verifying that $X is less than or equal to 100 and greater than or equal to 1 be more efficient than looking for an exact match against 100 values in a loop? (At least I assume that is what you are trying to do. I don't see any comparisons in your script at all.)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PERL Question

Can anyone tell me if the copy command in PERL has the same functionality as in KSH shell in UNIX or does it actually move the file ?? $cp_stat=system("cp $ENV{OLAMEBSDIR}/data/olam.ddabal$type $ENV{OLAMDIR}/balance/data/olam.ddabal$type.$HeaderDate"); (1 Reply)
Discussion started by: frank
1 Replies

2. Shell Programming and Scripting

Perl question

Hi everyone, Is Perl compiled? I keep running into references to Perl being compiled which is drivin me nuts because I thought it was an interpreted language. I am tired of the confusion, I am obviously misunderstanding something. Would someone mind explaining to me the exact order of events... (1 Reply)
Discussion started by: Jubba
1 Replies

3. Shell Programming and Scripting

Perl question

Hello Everybody, I am using perl..... I have a variable called line which stores the line of a file. I dont know how many words there will be in this line. But I would like to find out in perl and also store these words in the $1,$2,$3 and $4 variables eg if the line is "first second... (2 Replies)
Discussion started by: rkap
2 Replies

4. Shell Programming and Scripting

perl question

If I use 2 system commands in a script, will one finish before the next one starts? or will it start the first and the second at the same time? i.e. system("ps | grep rminer"); system("ls -al | grep 431"); (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

5. Shell Programming and Scripting

perl question

perl -wnl -e '/\bsomepattern\b/i and print $&;' I know above command only greps out the somepattern and print them(not entire line).. but how do I look for multiple pattern and only print them.. is that possible? perl -wnl -e '/\bsomepatternd\b/i and /\bsomepattern2\b/i and print $&;' does... (7 Replies)
Discussion started by: convenientstore
7 Replies

6. Shell Programming and Scripting

Perl Question

Hello all, I have the following line: xxx|xxxx|xxxx|xxx.xx|xxx And i insert the values in an array. I am trying to find out if the field of the array (where field=xxx.xx) has the '.' character. I am using the code below but it doesn't seem to work. if($field=~ /./) { ... (3 Replies)
Discussion started by: chriss_58
3 Replies

7. Linux

short question about cron and Mailoutput

Hi Guys, short question - thereīs every 5 minutes an cronjob for user "wwwrun" - and every 5 minutes root gets an email about this cronjob. Now my question: how can i realize, that root donīt get an email about this cronjob but on all other jobs ... perhaps crontab for wwwrun: */5... (2 Replies)
Discussion started by: jackcracker
2 Replies

8. Shell Programming and Scripting

PERL question

Hi, we complied the perl on diff machine ( /opt/dba/perl-5.8.8) . Created TAR and using it on diff box ( again the location is same) . when I tried to put this tar to diff locaiton , it PERL connections are failing . because the @ INC still pinting to : oracle@abc:/opt/dba/oraadmin/tools DEV$... (1 Reply)
Discussion started by: talashil
1 Replies

9. Programming

Perl question

Hi, please help me with below question i am executing the below command from command line perl -e '($hi)=glob("nosum*"); print "$hi"'; As i have nosum_website.sh file in current directory it gave the following output $ perl -e '($hi)=glob("nosum*"); print "$hi"';... (2 Replies)
Discussion started by: ragilla
2 Replies

10. Shell Programming and Scripting

Perl question about

Hello everybody, I am new at the forum and a total newbie when it comes to Unix. I am trying to see how I can add the ability to kill a user's processes? I want to add this to my Shel Script Add the code/process into a subroutine. Also, I would like to use an array to store the list... (0 Replies)
Discussion started by: kinelisch
0 Replies
break(1)							   User Commands							  break(1)

NAME
break, continue - shell built-in functions to escape from or advance within a controlling while, for, foreach, or until loop SYNOPSIS
sh break [n] continue [n] csh break continue ksh *break [n] *continue [n] DESCRIPTION
sh The break utility exits from the enclosing for or while loop, if any. If n is specified, break n levels. The continue utility resumes the next iteration of the enclosing for or while loop. If n is specified, resume at the n-th enclosing loop. csh The break utility resumes execution after the end of the nearest enclosing foreach or while loop. The remaining commands on the current line are executed. This allows multilevel breaks to be written as a list of break commands, all on one line. The continue utility continues execution of the next iteration of the nearest enclosing while or foreach loop. ksh The break utility exits from the enclosed for, while, until, or select loop, if any. If n is specified, then break n levels. If n is greater than the number of enclosing loops, the outermost enclosing loop shall be exited. The continue utility resumes the next iteration of the enclosed for, while, until, or select loop. If n is specified then resume at the n- th enclosed loop. If n is greater than the number of enclosing loops, the outermost enclosing loop shall be used. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words that follow a command preceded by ** that are in the format of a variable assignment are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign, and also that word splitting and file name genera- tion are not performed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), exit(1), ksh(1), sh( 1), attributes(5) SunOS 5.10 17 Jul 2002 break(1)
All times are GMT -4. The time now is 09:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy