Arguments for subroutine
am 30.07.2007 12:23:21 von Reddy.Beri-Veera-ext
This is a multi-part message in MIME format.
--===============0740379312==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C7D293.A8448020"
This is a multi-part message in MIME format.
------_=_NextPart_001_01C7D293.A8448020
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello,
I want to send array as input argument for subroutine. Please help me =
how to do this.
=20
Ex: =
ug_convert(@dr_con_list,$dataset,$datasettype,$release_statu s,$item_id,$i=
tem_revision,$local_option);
Sub convert()
{
=
local((@dr_con_list,$dataset,$datasettype,$release_status,$i tem_id,$item_=
revision,$local_option)=3D@_;
}
=20
but it is not giving correct values.
=20
Thanks && Regards=20
Karunakar Reddy B.V.=20
BSH Bosch Siemens Hausgeräte GmbH
ITD
Carl-Wery-Straße 34
81739 München
Tel.: +49 (0) 89 / 4590-3979
Fax: +49 (0) 89 / 4590-4489
e-mail: Reddy.Beri-Veera-ext@BSHG.COM
_______________________________________________
BSH Bosch und Siemens Hausgeräte GmbH, Carl-Wery-Str. 34, 81739 =
München
Vorsitzender des Aufsichtsrats: Rudi Lamprecht
Geschäftsführung: Dr. Kurt-Ludwig Gutberlet (Vors.), Dr. Wolfgang =
Colberg, Jean Dufour, Prof E.h. Werner Vogt
Sitz: München; Registergericht: Amtsgericht München; HRB 75534;
WEEE-Reg.-Nr. DE 57986696
=20
Diese Mitteilung ist ausschließlich für den beabsichtigten =
Empfänger bestimmt. Sie kann Betriebs- oder Geschäftsgeheimnisse =
oder sonstige vertrauliche Informationen enthalten. Jede(r) =
unberechtigte Gebrauch, Kopie, Weitergabe oder Veröffentlichung ist =
untersagt. Sollten Sie diese E-Mail irrtümlich erhalten haben, =
benachrichtigen Sie uns bitte sofort durch Antwortmail und löschen Sie =
diese E-Mail nebst etwaigen Anlagen und einschließlich aller =
angefertigten Kopien von Ihrem System.
=20
------_=_NextPart_001_01C7D293.A8448020
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
charset=3Diso-8859-1">
class=3D199001910-30072007>Hello,
class=3D199001910-30072007> I want to send=20
array as input argument for subroutine. Please help me how to do=20
this.
class=3D199001910-30072007>
Ex:=20
ug_convert(@dr_con_list,$dataset,$datasettype,$release_statu s,$item_id,$i=
tem_revision,$local_option);
Sub=20
convert()
class=3D199001910-30072007>{
class=3D199001910-30072007> =20
local((@dr_con_list,$dataset,$datasettype,$release_status,$i tem_id,$item_=
revision,$local_option)=3D@_;
class=3D199001910-30072007>}
class=3D199001910-30072007>
but it =
is not giving=20
correct values.
lang=3Den-us>
face=3D"Monotype Corsiva" color=3D#0000ff>
style=3D"BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: =
medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; MARGIN: 0cm 0cm =
0pt; BORDER-LEFT: medium none; PADDING-TOP: 0cm; BORDER-BOTTOM: =
windowtext; mso-element: para-border-div; mso-border-bottom-alt: solid =
windowtext .75pt; mso-padding-alt: 0cm 0cm 1.0pt 0cm"=20
align=3Dleft>
style=3D"COLOR: blue">Thanks && =
Regards=20
Karunakar Reddy B.V.
"urn:schemas-microsoft-com:office:office" =
/>
style=3D"MARGIN: 0cm 0cm 0pt; mso-pagination: none; =
mso-layout-grid-align: none">
lang=3DDE style=3D"FONT-SIZE: 9pt; FONT-FAMILY: Arial; =
mso-ansi-language: DE">
color=3D#000000>BSH Bosch Siemens Hausgeräte =
GmbH
style=3D"MARGIN: 0cm 0cm 0pt; mso-pagination: none; =
mso-layout-grid-align: none">
lang=3DDE style=3D"FONT-SIZE: 9pt; FONT-FAMILY: Arial; =
mso-ansi-language: DE">
color=3D#000000>ITD
style=3D"MARGIN: 0cm 0cm 0pt; mso-pagination: none; =
mso-layout-grid-align: none">
lang=3DDE style=3D"FONT-SIZE: 9pt; FONT-FAMILY: Arial; =
mso-ansi-language: DE">
color=3D#000000>Carl-Wery-Straße 34
style=3D"MARGIN: 0cm 0cm 0pt; mso-pagination: none; =
mso-layout-grid-align: none">
lang=3DDE style=3D"FONT-SIZE: 9pt; FONT-FAMILY: Arial; =
mso-ansi-language: DE">
color=3D#000000>81739 München
style=3D"MARGIN: 0cm 0cm 0pt; mso-pagination: none; =
mso-layout-grid-align: none">
lang=3DDE style=3D"FONT-SIZE: 9pt; FONT-FAMILY: Arial; =
mso-ansi-language: DE">
color=3D#000000>Tel.: +49 (0) 89 / =
4590-3979
style=3D"MARGIN: 0cm 0cm 0pt; mso-pagination: none; =
mso-layout-grid-align: none">
lang=3DDE style=3D"FONT-SIZE: 9pt; FONT-FAMILY: Arial; =
mso-ansi-language: DE">
color=3D#000000>Fax: +49 (0) 89 / 4590-4489
style=3D"MARGIN: 0cm 0cm 0pt; mso-pagination: none; =
mso-layout-grid-align: none">
lang=3DDE style=3D"FONT-SIZE: 9pt; FONT-FAMILY: Arial; =
mso-ansi-language: DE">
color=3D#000000>e-mail:
style=3D"COLOR: =
blue">Reddy.Beri-Veera-ext@BSHG.COM
style=3D"MARGIN: 0cm 0cm 0pt; mso-pagination: none; =
mso-layout-grid-align: none">
color=3D#000000>
style=3D"FONT-SIZE: 9pt; FONT-FAMILY: '@Arial Unicode MS'; =
mso-ansi-language: DE; mso-hansi-font-family: Arial; =
mso-bidi-font-family: '@Arial Unicode =
MS'">______________________________________________
lang=3DDE=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: '@Arial Unicode MS'; =
mso-ansi-language: DE; mso-hansi-font-family: Arial; =
mso-bidi-font-family: '@Arial Unicode =
MS'">_
face=3D"Monotype Corsiva" color=3D#0000ff>
BSH Bosch und Siemens Hausgeräte GmbH, Carl-Wery-Str. 34, 81739 =
München
Vorsitzender des Aufsichtsrats: Rudi Lamprecht
Geschäftsführung: Dr. Kurt-Ludwig Gutberlet (Vors.), Dr. Wolfgang =
Colberg,=20
Jean Dufour, Prof E.h. Werner Vogt
Sitz: München; Registergericht: Amtsgericht München; HRB =
75534;
WEEE-Reg.-Nr. DE 57986696
Diese Mitteilung ist ausschließlich für den beabsichtigten =
Empfänger=20
bestimmt. Sie kann Betriebs- oder Geschäftsgeheimnisse oder sonstige=20
vertrauliche Informationen enthalten. Jede(r) unberechtigte Gebrauch, =
Kopie,=20
Weitergabe oder Veröffentlichung ist untersagt. Sollten Sie diese =
E-Mail=20
irrtümlich erhalten haben, benachrichtigen Sie uns bitte sofort durch=20
Antwortmail und löschen Sie diese E-Mail nebst etwaigen Anlagen und=20
einschließlich aller angefertigten Kopien von Ihrem=20
System.
------_=_NextPart_001_01C7D293.A8448020--
--===============0740379312==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0740379312==--
Re: Arguments for subroutine
am 30.07.2007 12:33:12 von n.haigh
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Beri-Veera-ext, Reddy (n.a.) wrote:
> Hello,
> I want to send array as input argument for subroutine. Please help me how to do this.
>
> Ex: ug_convert(@dr_con_list,$dataset,$datasettype,$release_statu s,$item_id,$item_revision,$local_option);
> Sub convert()
> {
> local((@dr_con_list,$dataset,$datasettype,$release_status,$i tem_id,$item_revision,$local_option)=@_;
> }
>
> but it is not giving correct values.
You need to pass a reference to the array and then dereference it within
the subroutine:
ug_convert(\@dr_con_list,$dataset,$datasettype,$release_stat us,$item_id,$item_revision,$local_option);
Sub convert()
{
my($dr_con_list,$dataset,$datasettype,$release_status,$item_ id,$item_revision,$local_option)=@_;
# then need to deference using things like:
my $first_element = $dr_con_list->[0];
foreach my $element ( @{$dr_con_list} ) {
# do something with each element of the list
}
}
HTH
Nath
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGsGDch5z4PPfwHQoRAqDBAJ9ZlnIjQC9im3keOJUr1hqLwGgzoQCg 44mD
ZdH5iu8lYkwpUGJOlV/x4rU=
=zYvX
-----END PGP SIGNATURE-----
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Arguments for subroutine
am 30.07.2007 13:15:23 von Bill Luebkert
Nathan S Haigh wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Beri-Veera-ext, Reddy (n.a.) wrote:
>
>>Hello,
>> I want to send array as input argument for subroutine. Please help me how to do this.
>>
>>Ex: ug_convert(@dr_con_list,$dataset,$datasettype,$release_statu s,$item_id,$item_revision,$local_option);
>>Sub convert()
>>{
>> local((@dr_con_list,$dataset,$datasettype,$release_status,$i tem_id,$item_revision,$local_option)=@_;
>>}
>>
>>but it is not giving correct values.
>
>
> You need to pass a reference to the array and then dereference it within
> the subroutine:
Or if you only have one array, you can just pass it as the last argument.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Arguments for subroutine
am 30.07.2007 13:50:14 von Reddy.Beri-Veera-ext
Hello,
Thanks for your help. I wrote like
$status
=ug_convert(\@dr_con_list,$dataset,$datasettype,$release_sta tus,$item_id
,$item_revision,$local_option);
Sub ug_convert()
{
my($local_con_list,$local_dataset,$local_datasettype,$local_ release_stat
us,$local_item_id,$local_item_rev,$local_option) = @_;
foreach my $element ( @{$local_con_list} )
{print "$element\n";}
}
But it is giving the error
Error: Missing $ on loop variable at
C:\UG\tceng0913\bsh\export\bin\bsh_flexcax_export_server.pl line 1300
Please help on this.
Thanks && Regards
Karunakar Reddy B.V.
-----Original Message-----
From: Nathan S Haigh [mailto:n.haigh@sheffield.ac.uk]
Sent: 01 August 2007 12:31
To: Beri-Veera-ext, Reddy (n.a.)
Cc: ActivePerl
Subject: Re: Arguments for subroutine
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Beri-Veera-ext, Reddy (n.a.) wrote:
> Hello,
> I want to send array as input argument for subroutine. Please help me
how to do this.
>
> Ex:
ug_convert(@dr_con_list,$dataset,$datasettype,$release_statu s,$item_id,$
item_revision,$local_option);
> Sub convert()
> {
>
local((@dr_con_list,$dataset,$datasettype,$release_status,$i tem_id,$item
_revision,$local_option)=@_;
> }
>
> but it is not giving correct values.
You need to pass a reference to the array and then dereference it within
the subroutine:
ug_convert(\@dr_con_list,$dataset,$datasettype,$release_stat us,$item_id,
$item_revision,$local_option);
Sub convert()
{
my($dr_con_list,$dataset,$datasettype,$release_status,$item_ id,$item_rev
ision,$local_option)=@_;
# then need to deference using things like:
my $first_element = $dr_con_list->[0];
foreach my $element ( @{$dr_con_list} ) {
# do something with each element of the list
}
}
HTH
Nath
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGsGDch5z4PPfwHQoRAqDBAJ9ZlnIjQC9im3keOJUr1hqLwGgzoQCg 44mD
ZdH5iu8lYkwpUGJOlV/x4rU=
=zYvX
-----END PGP SIGNATURE-----
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Arguments for subroutine
am 30.07.2007 13:57:26 von n.haigh
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Beri-Veera-ext, Reddy (n.a.) wrote:
> Hello,
> Thanks for your help. I wrote like
> $status
> =ug_convert(\@dr_con_list,$dataset,$datasettype,$release_sta tus,$item_id
> ,$item_revision,$local_option);
> Sub ug_convert()
> {
>
> my($local_con_list,$local_dataset,$local_datasettype,$local_ release_stat
> us,$local_item_id,$local_item_rev,$local_option) = @_;
> foreach my $element ( @{$local_con_list} )
> {print "$element\n";}
> }
>
> But it is giving the error
> Error: Missing $ on loop variable at
> C:\UG\tceng0913\bsh\export\bin\bsh_flexcax_export_server.pl line 1300
>
> Please help on this.
>
> Thanks && Regards
> Karunakar Reddy B.V.
>
I don't see anything obviously wrong - are you able to supply more of
your code around line 1300 and also indicate which line is 1300.
Nath
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGsHUrh5z4PPfwHQoRAgzyAKCK05hPNkW0ZXntthni8666MObBBQCf QN4j
WDtK6yFOovCRWTIIGpgBlMg=
=Heat
-----END PGP SIGNATURE-----
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Arguments for subroutine
am 30.07.2007 14:08:57 von Reddy.Beri-Veera-ext
This is a multi-part message in MIME format.
------_=_NextPart_001_01C7D2A2.68954223
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi Please see my sample program.
Error:Missing $ on loop variable at
C:\BSH\Flexcax_export\samples\arry_arg.pl line 11.
Thanks && Regards=20
Karunakar Reddy B.V.=20
-----Original Message-----
From: Nathan S Haigh [mailto:n.haigh@sheffield.ac.uk]=20
Sent: 01 August 2007 13:58
To: Beri-Veera-ext, Reddy (n.a.)
Cc: ActivePerl
Subject: Re: Arguments for subroutine
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Beri-Veera-ext, Reddy (n.a.) wrote:
> Hello,
> Thanks for your help. I wrote like
> $status
>
=3Dug_convert(\@dr_con_list,$dataset,$datasettype,$release_s tatus,$item_i=
d
> ,$item_revision,$local_option);=20
> Sub ug_convert()
> {
> =20
>
my($local_con_list,$local_dataset,$local_datasettype,$local_ release_stat
> us,$local_item_id,$local_item_rev,$local_option) =3D @_;
> foreach my $element ( @{$local_con_list} )
> {print "$element\n";}
> }
>=20
> But it is giving the error
> Error: Missing $ on loop variable at
> C:\UG\tceng0913\bsh\export\bin\bsh_flexcax_export_server.pl line 1300
>=20
> Please help on this.
>=20
> Thanks && Regards=20
> Karunakar Reddy B.V.=20
>=20
I don't see anything obviously wrong - are you able to supply more of
your code around line 1300 and also indicate which line is 1300.
Nath
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGsHUrh5z4PPfwHQoRAgzyAKCK05hPNkW0ZXntthni8666MObBBQCf QN4j
WDtK6yFOovCRWTIIGpgBlMg=3D
=3DHeat
-----END PGP SIGNATURE-----
------_=_NextPart_001_01C7D2A2.68954223
Content-Type: application/octet-stream;
name="arry_arg.pl"
Content-Transfer-Encoding: base64
Content-Description: arry_arg.pl
Content-Disposition: attachment;
filename="arry_arg.pl"
IyEvdXNyL2Jpbi9wZXJsDQokc3RhdHVzID0gdWdfY29udmVydChcQGRyX2Nv bl9saXN0LCRkYXRh
c2V0LCRkYXRhc2V0dHlwZSwkcmVsZWFzZV9zdGF0dXMsJGl0ZW1faWQsJGl0 ZW1fcmV2aXNpb24s
JGxvY2FsX29wdGlvbik7IA0Kc3ViIHVnX2NvbnZlcnQoKQ0Kew0KICBteSgk bG9jYWxfY29uX2xp
c3QsJGxvY2FsX2RhdGFzZXQsJGxvY2FsX2RhdGFzZXR0eXBlLCRsb2NhbF9y ZWxlYXNlX3N0YXR1
cywkbG9jYWxfaXRlbV9pZCwkbG9jYWxfaXRlbV9yZXYsJGxvY2FsX29wdGlv bikgPSBAXzsNCiAg
cHJpbnQgImVudGVyZWQgaW4gdG8gY29udmVydGlvbiBmb3JtXG4iOw0KICAN CiAgICAgbXkgJGZp
cnN0X2VsZW1lbnQgPSAkbG9jYWxfY29uX2xpc3QtPlswXTsNCiAgICAgcHJp bnQgIiRmaXJzdF9l
bGVtZW50XG4iOw0KICAgICAjcHJpbnQgInRoZSBjb24gY291bnQgaXMgJGNv bl9saXN0X2xlblxu
IjsNCiAgICAgZm9yZWFjaCBteSAkZWxlbWVudCAoIEB7JGxvY2FsX2Nvbl9s aXN0fSApDQogICAg
IHtwcmludCAiJGVsZW1lbnRcbiI7fQ0KfQ0K
------_=_NextPart_001_01C7D2A2.68954223
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
------_=_NextPart_001_01C7D2A2.68954223--
Re: Arguments for subroutine
am 30.07.2007 14:27:46 von Bill Luebkert
Beri-Veera-ext, Reddy (n.a.) wrote:
> Hi Please see my sample program.
> Error:Missing $ on loop variable at
> C:\BSH\Flexcax_export\samples\arry_arg.pl line 11.
This gets no errors:
#!/usr/bin/perl
use strict;
use warnings;
my @dr_con_list = (1, 2, 3, 4);
my $dataset = 1;
my $datasettype = 1;
my $release_status = 1;
my $item_id = 1;
my $item_revision = 1;
my $local_option = 1;
my $status = ug_convert (\@dr_con_list, $dataset, $datasettype,
$release_status, $item_id, $item_revision, $local_option);
sub ug_convert {
my ($local_con_list, $local_dataset, $local_datasettype,
$local_release_status, $local_item_id, $local_item_rev,
$local_option) = @_;
print "entered ug_convert\n";
my $first_element = $local_con_list->[0];
print "first_element = $first_element\n";
foreach my $element (@{$local_con_list}) {
print "element=$element\n";
}
}
__END__
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Arguments for subroutine
am 30.07.2007 14:43:07 von n.haigh
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Beri-Veera-ext, Reddy (n.a.) wrote:
> Hi Please see my sample program.
> Error:Missing $ on loop variable at
> C:\BSH\Flexcax_export\samples\arry_arg.pl line 11.
>
>
> Thanks && Regards
> Karunakar Reddy B.V.
>
>
Firstly, the script you supplied doesn't run on it's own! Ensure you
have the following at the top of your script:
use strict;
use warnings;
They will force you to use good programming practice when it comes to
scope etc. You will then need to specify values for variables you pass
to your method.
The slightly modified version of your script produces no warnings like
the one you mentioned:
#!/usr/bin/perl
use strict;
use warnings;
my @dr_con_list = (1..10);
my $dataset = 1;
my $datasettype = 1;
my $release_status = 1;
my $item_id = 1;
my $item_revision = 1;
my $local_option = 1;
my $status =
&ug_convert(\@dr_con_list,$dataset,$datasettype,$release_sta tus,$item_id,$item_revision,$local_option);
sub ug_convert
{
my($local_con_list,$local_dataset,$local_datasettype,$local_ release_status,$local_item_id,$local_item_rev,$local_option)
= @_;
print "entered in to convertion form\n";
my $first_element = $local_con_list->[0];
print "$first_element\n";
#print "the con count is $con_list_len\n";
foreach my $element ( @{$local_con_list} )
{print "$element\n";}
}
__END__
Changes I made:
1) added "use strict;" and "use warnings;" at the top of the script.
2) set the values of the method arguments to some value as you didn;t
supply any.
3) set scope of $status using "my"
Nath
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGsH/eh5z4PPfwHQoRAhSGAJwJENIBNImick3No/J2KBrIUUrsKACg ioYE
N4lu+J1wTWWXqMJcJroF83U=
=Cipd
-----END PGP SIGNATURE-----
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs