Re: Array problem

2006-01-23 Thread Ditlev, Unix Consulting
Is this what you wan't ?

> open INPUT,"<$ARGV[0]";
> while ($line=){
>push (@array,$line);
> }

>foreach $i(@array){
>print $i;
>   }

"Andrej Kastrin" <[EMAIL PROTECTED]> skrev i en meddelelse 
news:[EMAIL PROTECTED]
>I wrote simple script, which have to concatenate multiple lines into array 
>and then print each element of tihis array:
>
> open INPUT,"<$ARGV[0]";
> while ($line=){
>push (@array,$line);
>foreach $i(@array){
>print $i;
>   }
> }
>
> Input is e.g.
> line 1
> line 2
>
> I don't know where is the problem, Please, help!
>
> Cheers, Andrej 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: parse hash to module

2005-12-22 Thread Ditlev, Unix Consulting
"JupiterHost.Net" <[EMAIL PROTECTED]> skrev i en meddelelse 
news:[EMAIL PROTECTED]
>
>>>You can do either but a refernce is more efficient:
>>
>> Maybe I should use a reference as you suggest now Iam using ...
>>
>> MyModule::function(%person)
>>
>> and in my function :
>> my %person = @_;
>>
>> For now I don't think I have an performance issue, - but ofcourse for now 
>> I have 2 copies.
>
> 2 copies is twtice the memory :) plus its more maintainable and 
> expandable.
>
>> Any drawbacks if I try some kind of asyncrhonous call if possbile ??.
>
> Can you give us some code of what you mean by "asyncronouse call"?

It's a db interface, - but I don't thinks it's relevant but maybe just exit 
my module after having
delivered the data to the dbi ?? 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: parse hash to module

2005-12-19 Thread Ditlev, Unix Consulting
"JupiterHost.Net" <[EMAIL PROTECTED]> skrev i en meddelelse 
news:[EMAIL PROTECTED]
> Ditlev, Unix Consulting wrote:
>> Hi There,
>
> Hello,
>
>> I have some problems undestanding how to parse a hash to module of my 
>> own.
>>
>> I have this hash %person :
>> $person{$Name}{Name} = "xxx";
>> $person{$Name}{Id} = ;
>> @( $person{$Name} {Friends} )
>>
>> But what's the correct method for parsing this hash to my module ???
>>
>> I try something like mymodule::method(%person)
>>
>> or should I parse it as a reference ?
>> mymodule::method(\$person)
>
> I think "parse" is the wrong word :) i think you mean "pass"?

Yes its pass I mean.

>
> You can do either but a refernce is more efficient:
Maybe I should use a reference as you suggest now Iam using ...

MyModule::function(%person)

and in my function :
my %person = @_;

For now I don't think I have an performance issue, - but ofcourse for now I 
have 2 copies. Any drawbacks if I try some kind of asyncrhonous call if 
possbile ??.

Thnks for the input.

>
> MyModule::function(\%person);
>
> MyModule->method(\%person);
>
>
> sub ... {
>
>my ($person_ref) = @_;
>
> ...
>
> } 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




parse hash to module

2005-12-18 Thread Ditlev, Unix Consulting
Hi There,

I have some problems undestanding how to parse a hash to module of my own.

I have this hash %person :
$person{$Name}{Name} = "xxx";
$person{$Name}{Id} = ;
@( $person{$Name} {Friends} )

But what's the correct method for parsing this hash to my module ???

I try something like mymodule::method(%person)

or should I parse it as a reference ?
mymodule::method(\$person)

Any input is appreciated.

best regards
 Tommy 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]