Sponsored Content
Full Discussion: perl syntax help
Top Forums Shell Programming and Scripting perl syntax help Post 302425595 by livewire06 on Friday 28th of May 2010 02:26:48 PM
Old 05-28-2010
its supposed to accept exactly 2 integer arguments where the first argument must be less than the second argument. The script will print a comma separated list of integers starting with the first argument up through the second argument.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl command syntax for C:\dir

Hi Everyone, Perl command syntax that would display my ... C:\dir .... Regards, asabzevari (1 Reply)
Discussion started by: asabzevari
1 Replies

2. UNIX for Advanced & Expert Users

perl explain syntax !!!

hi all i was going through some perl code i came across this line and i am not getting what is exactly going on .. $$this{localtion} = GetName->GetVarName("EXE_DIR") ; what is the red part doing in above code (2 Replies)
Discussion started by: zedex
2 Replies

3. Shell Programming and Scripting

perl version for syntax errors

All, Does it matter what perl verios your running when you get syntax errors? on version 5.6.1 the code works fine, but on 5.8.0 the code gets errors? #!/usr/bin/perl #use strict; #use warnings; my $mess = 'messages'; my $mess1 = 'messages.1'; my $mess2 = 'messages.2'; my... (13 Replies)
Discussion started by: bigben1220
13 Replies

4. Shell Programming and Scripting

PERL Syntax Errors

Hi, I am a newbie to PERL and working on a script. When running it I get a lot of compilation errors. The actual command in the program (which is within a case structure) is given below # This gives the actual count of inquires from a log file (It works fine when I type this on the... (2 Replies)
Discussion started by: nurani
2 Replies

5. Shell Programming and Scripting

Perl syntax that I don't understand.

I'm just trying to confirm that I understand someone's code correctly. If someone has code that says: $foo ||= mysub(); I'm assuming that it means if $foo is nothing or undef, then assign it some value via mysub(). If I'm wrong on this, please let me know. Also, what's the difference... (4 Replies)
Discussion started by: mrwatkin
4 Replies

6. Programming

Syntax error in perl program.

Hi, i am running this code but i am getting syntax error #!/usr/bin/perl use warnings; use strict; use XML::LibXML; use XML::LibXML::Reader; use Data::Dumper; my $file; open( $file, 'DTC_Specification_transformed.xml'); my $reader = XML::LibXML::Reader->new( IO => $file ) or die... (1 Reply)
Discussion started by: veerubiji
1 Replies

7. Programming

Perl syntax question

Hallo everybody, I have a following problem - I'm doing a map funciont to fill in a HTML table and I want to use some radiobutton groups. Unfortunatelly, they are grouped by names, so I have to add some "counter" that will divide one row from another, and I'm using CGI.pm for generating the... (3 Replies)
Discussion started by: duskos
3 Replies

8. Shell Programming and Scripting

Perl syntax

I'm a newbie to perl scripting. Can someone please explain the syntax below. Specifically what does -> and => do? $tz->site( => $site); (10 Replies)
Discussion started by: scj2012
10 Replies

9. UNIX for Dummies Questions & Answers

Perl syntax

Query with perl syntax Aim: is to change a perl script to use a new file I was required to replace - entries \"$entries\" with -lib <full_path_to_filename> So in the code detector.pm sub rundetector { my $class = shift; mkdir($resultDirectory); my... (3 Replies)
Discussion started by: sa@@
3 Replies

10. Shell Programming and Scripting

A Perl Syntax Question.

Greetings! Here's what I believe is a "simple one" for the community tonight ;) What I'm trying to do is assign a "true/false" value to a variable depending upon whether a named process (some-process) exists; and then test for this value in the succeeding logic. I banged my head against the... (2 Replies)
Discussion started by: LinQ
2 Replies
VARARGS(3)						     Library Functions Manual							VARARGS(3)

NAME
varargs - variable argument list SYNOPSIS
#include <varargs.h> function(va_alist) va_dcl va_list pvar; va_start(pvar); f = va_arg(pvar, type); va_end(pvar); DESCRIPTION
This set of macros provides a means of writing portable procedures that accept variable argument lists. Routines having variable argument lists (such as printf(3)) that do not use varargs are inherently nonportable, since different machines use different argument passing con- ventions. va_alist is used in a function header to declare a variable argument list. va_dcl is a declaration for va_alist. Note that there is no semicolon after va_dcl. va_list is a type which can be used for the variable pvar, which is used to traverse the list. One such variable must always be declared. va_start(pvar) is called to initialize pvar to the beginning of the list. va_arg(pvar, type) will return the next argument in the list pointed to by pvar. Type is the type to which the expected argument will be converted when passed as an argument. In standard C, arguments that are char or short should be accessed as int, unsigned char or unsigned short are converted to unsigned int, and float arguments are converted to double. Different types can be mixed, but it is up to the rou- tine to know what type of argument is expected, since it cannot be determined at runtime. va_end(pvar) is used to finish up. Multiple traversals, each bracketed by va_start ... va_end, are possible. EXAMPLE
#include <varargs.h> execl(va_alist) va_dcl { va_list ap; char *file; char *args[100]; int argno = 0; va_start(ap); file = va_arg(ap, char *); while (args[argno++] = va_arg(ap, char *)) ; va_end(ap); return execv(file, args); } BUGS
It is up to the calling routine to determine how many arguments there are, since it is not possible to determine this from the stack frame. For example, execl passes a 0 to signal the end of the list. Printf can tell how many arguments are supposed to be there by the format. The macros va_start and va_end may be arbitrarily complex; for example, va_start might contain an opening brace, which is closed by a matching brace in va_end. Thus, they should only be used where they could be placed within a single complex statement. 7th Edition May 15, 1986 VARARGS(3)
All times are GMT -4. The time now is 02:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy