[rearranged to bottom posting style]

Marc Sacks am Dienstag, 26. September 2006 14:25:
> D. Bolliger wrote:
> >elite elite am Montag, 25. September 2006 22:27:
> >>I not sure what i doing wroung.
> >
> >I'm not sure either :-)
> >
> >>Street="Wright";
> >
> >This is wrong syntax; "Street" is not a scalar variable, while "$street"
> > would be.
> >
> >>print "$street\n";
> >
> >$street is undef here, you didn't assign anything to the $street variable.
> >
> >>$street="Washington";
> >
> >That's ok, but never used.
> >
> >>And i get this output.
> >>Street/[EMAIL PROTECTED] ~]$
> >
> >Weird, I can't explain that. Your code (is it a snippet from the actual
> > code?) does not even compile on my box and (correctly) emits the error:
> >
> >  Can't modify constant item in scalar assignment at - line 1,
> >  near ""Wright";"
> >  Execution of - aborted due to compilation errors.
> >
> >
> >- How exactly did you invoke your code?
> >- What is output if you run the code:
> >
> >#!/usr/bin/perl
> >
> >use strict;
> >use warnings;
> >
> >my $street='Wright'; # ok, why not :-)
> >print "$street\n";
> >$street='Washington';
> >print "$street\n";
> >
> >__END__
> >
> >?
> >
> >
> >Dani

Hello Marc

> Odd. I just tried the same code snippet and it worked fine.

Do you refer to the original code?

  #!/usr/bin/perl

  Street="Wright";
  print "$street\n";
  $street="Washington";

This would be very odd?!?

> You might try putting a space before and after your "=" signs.

Yes, many people consider this better formatting style...

> I don't know if that makes a difference, but it won't hurt.

... but it won't change the interpretation of the code by perl :-)

Dani

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


Reply via email to