lina wrote:
Hi,
Hello,
I have a file,
cat try.xpm
a 1
b 2
c 3
d 4
abbbcdddb
I wish to use perl to translate the last line into the numerical value.
#!/usr/bin/perl
use warnings;
use strict;
open FILE, ";
while () {
print $_;
}
strangely it print me nothing out,
Thanks
On 12-02-17 12:49 PM, Leo Susanto wrote:
On Fri, Feb 17, 2012 at 9:17 AM, lina wrote:
Thanks, here why you use '<', not "<"
http://perldoc.perl.org/perlop.html#Quote-and-Quote-like-Operators
'<' is literal, no interpolation. "<" is literal with interpolation.
in this particular case, there
On Fri, Feb 17, 2012 at 9:17 AM, lina wrote:
> Thanks, here why you use '<', not "<"
http://perldoc.perl.org/perlop.html#Quote-and-Quote-like-Operators
'<' is literal, no interpolation. "<" is literal with interpolation.
in this particular case, there is no difference between '<' and "<".
But,
Please note that I have rearranged the order of quotes for
sanity. I hope that nobody minds or feels that I am
misrepresenting the authors..
On Fri, Feb 17, 2012 at 10:58:45AM -0600, Hal Wigoda wrote:
> On Fri, Feb 17, 2012 at 9:32 AM, lina wrote:
> > #!/usr/bin/perl
> >
> > use warnings;
> > use
On Sat, Feb 18, 2012 at 12:53 AM, Shawn H Corey wrote:
> On 12-02-17 11:43 AM, lina wrote:
>>
>> #!/usr/bin/perl
>>
>> use warnings;
>> use strict;
>>
>> my $file = "try.xpm";
>>
>> open my $fh, "<$file" or die "could not open $file: $!\n";
>
>
> Use the three argument open, please:
>
> open my
On Sat, Feb 18, 2012 at 12:53 AM, Shawn H Corey wrote:
> On 12-02-17 11:43 AM, lina wrote:
>>
>> #!/usr/bin/perl
>>
>> use warnings;
>> use strict;
>>
>> my $file = "try.xpm";
>>
>> open my $fh, "<$file" or die "could not open $file: $!\n";
>
>
> Use the three argument open, please:
>
> open my
I don't know if this will fix it,
but line 6 is missing a closing >.
On Fri, Feb 17, 2012 at 9:32 AM, lina wrote:
> Hi,
>
> I have a file,
>
> cat try.xpm
> a 1
> b 2
> c 3
> d 4
>
> abbbcdddb
>
>
> I wish to use perl to translate the last line into the numerical value.
>
> #!/usr/bin/perl
On Sat, Feb 18, 2012 at 12:33 AM, Jim Gibson wrote:
> At 12:10 AM +0800 2/18/12, lina wrote:
>>
>>
>> What's the $_ and $@
>
>
> They are built-in global variables. $_ is the default variable for many Perl
> operations. $@ is the syntax error message from the last eval (why are you
> asking about
On 12-02-17 11:49 AM, lina wrote:
open my $fh, '<', $file or die "could not open $file: $!\n";
Here why use $!
?
$! is the OS error. If an OS error occurs, like an open error, it
contains the related error message. See `perldoc perlvar` and search for
/OS_ERROR/
--
Just my 0.0002 mill
On 12-02-17 11:43 AM, lina wrote:
#!/usr/bin/perl
use warnings;
use strict;
my $file = "try.xpm";
open my $fh, "<$file" or die "could not open $file: $!\n";
Use the three argument open, please:
open my $fh, '<', $file or die "could not open $file: $!\n";
while (my $xpm_file = my<$fh>)
On Sat, Feb 18, 2012 at 12:25 AM, Shawn H Corey wrote:
> On 12-02-17 10:32 AM, lina wrote:
>>
>> #!/usr/bin/perl
>>
>> use warnings;
>> use strict;
>>
>> open FILE, ">
>> my @line =;
>>
>> while () {
>> print $_;
>> }
>>
>> strangely it print me nothing out,
>
>
> Try:
>
>
> #!/usr/bin/perl
On Sat, Feb 18, 2012 at 12:25 AM, Shawn H Corey wrote:
> On 12-02-17 10:32 AM, lina wrote:
>>
>> #!/usr/bin/perl
>>
>> use warnings;
>> use strict;
>>
>> open FILE, ">
>> my @line =;
>>
>> while () {
>> print $_;
>> }
>>
>> strangely it print me nothing out,
>
>
> Try:
>
>
> #!/usr/bin/perl
At 12:10 AM +0800 2/18/12, lina wrote:
What's the $_ and $@
They are built-in global variables. $_ is the default variable for
many Perl operations. $@ is the syntax error message from the last
eval (why are you asking about $@; it doesn't appear in your
program?).
I can guess about its
On 12-02-17 10:32 AM, lina wrote:
#!/usr/bin/perl
use warnings;
use strict;
open FILE, ";
while () {
print $_;
}
strangely it print me nothing out,
Try:
#!/usr/bin/perl
use warnings;
use strict;
# place the file name in a variable
# so that it can be easier changed later
my $file
On Fri, Feb 17, 2012 at 11:49 PM, Rob Coops wrote:
>
>
> On Fri, Feb 17, 2012 at 4:32 PM, lina wrote:
>>
>> Hi,
>>
>> I have a file,
>>
>> cat try.xpm
>> a 1
>> b 2
>> c 3
>> d 4
>>
>> abbbcdddb
>>
>>
>> I wish to use perl to translate the last line into the numerical value.
>>
>> #!/usr/bin
On Fri, Feb 17, 2012 at 4:32 PM, lina wrote:
> Hi,
>
> I have a file,
>
> cat try.xpm
> a 1
> b 2
> c 3
> d 4
>
> abbbcdddb
>
>
> I wish to use perl to translate the last line into the numerical value.
>
> #!/usr/bin/perl
>
> use warnings;
> use strict;
>
> open FILE, "
> my @line = ;
>
> wh
Hi,
I have a file,
cat try.xpm
a 1
b 2
c 3
d 4
abbbcdddb
I wish to use perl to translate the last line into the numerical value.
#!/usr/bin/perl
use warnings;
use strict;
open FILE, ";
while () {
print $_;
}
strangely it print me nothing out,
Thanks for any suggestions,
Bes
17 matches
Mail list logo