[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Re: Activestateperl vs perl p å Linux/Unix



Poul Kristensen <sslug@sslug> writes:

> print fil "$var1 \$var2 \$var3 \$var4 \$var5 \n"

Givet

  my $var1 = "foo";
  my $var2 = "bar";
  my $var3 = "baz";
  my $var4 = 17;
  my $var5 = 42;

  print "$var1 \$var2 \$var3 \$var4 \$var5 \n";

Vil jeg helt klart forvente følgende resultat:

  foo $var2 $var3 $var4 $var5 

Som Jonas beskriver så vil en backslash foran dollar-tegnet forhindre
interpolation af variablen.

Har du problemer i et script eller i en one-liner?

Med one-liners skal man holde tungen lidt mere lige i munden, for her
vil ens shell foretage en interpolation inden perl ser "scriptet". Det
betyder at der kan være stor forskel mellem forskellige shells. I den
henseende er standard-shellen i windows vist ikke helt let at danse med
- uden jeg dog har noget kendskab til den.

//Makholm


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2013-05-07, 11:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *