osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: how to understand shift? - msg#00079

List: beginners@haskell.org

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

#!/usr/bin/perl

$month = "December";
$year = "2007" ;

header($month,$year);

sub header {

my $month = shift ;
my $year = shift ; ######## here after shift the $year becomes null?
http://perldoc.perl.org/functions/shift.html

print "-" x 79, "\n" ;

print "$month $year Sales Report\n" ;

print "-" x 79, "\n" ;

$month = "January" ;
}

Thanks,

--
To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx
For additional commands, e-mail: beginners-help@xxxxxxxx
http://learn.perl.org/


Thread at a glance:

Previous Message by Date:

Re: syntax error near unexpected token `;'

On Tue, Feb 7, 2012 at 12:49 PM, Parag Kalra <paragkalra@xxxxxxxxx> wrote: > > > On Mon, Feb 6, 2012 at 8:35 PM, lina <lina.lastname@xxxxxxxxx> wrote: >> >> until ($name eq ""); >> do { >>        print "Enter another name, or Enter to stop:\n" ; >>        $name = <STDIN>; >>        chomp ($name); >>        push @namelist,$name; >> >> } >> >> print @namelist > > > This should work. Also start using strict and warnings pragma. > > do { >        print "Enter another name, or Enter to stop:\n" ; >        $name = <STDIN>; >        chomp ($name); >        push @namelist,$name; > > }until ($name eq ""); > > print @namelist > > Thank You, I was so careless. #!/usr/bin/perl missed the ! -- To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx For additional commands, e-mail: beginners-help@xxxxxxxx http://learn.perl.org/

Next Message by Date:

Re: how to understand shift?

ä 2012-2-7 15:07, lina åé: my $month = shift ; my $year = shift ; ######## here after shift the $year becomes null? http://perldoc.perl.org/functions/shift.html after shift the @_ becomes null. $year is 2007. -- To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx For additional commands, e-mail: beginners-help@xxxxxxxx http://learn.perl.org/

Previous Message by Thread:

syntax error near unexpected token `;'

#/usr/bin/perl until ($name eq ""); do { print "Enter another name, or Enter to stop:\n" ; $name = <STDIN>; chomp ($name); push @namelist,$name; } print @namelist $ ./generate_namelist.pl ./generate_namelist.pl: line 6: syntax error near unexpected token `;' ./generate_namelist.pl: line 6: ` $name = <STDIN>;' Thanks for any advice, Best Regards, -- To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx For additional commands, e-mail: beginners-help@xxxxxxxx http://learn.perl.org/

Next Message by Thread:

Re: how to understand shift?

ä 2012-2-7 15:07, lina åé: my $month = shift ; my $year = shift ; ######## here after shift the $year becomes null? http://perldoc.perl.org/functions/shift.html after shift the @_ becomes null. $year is 2007. -- To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx For additional commands, e-mail: beginners-help@xxxxxxxx http://learn.perl.org/
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!