LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-07-2010, 11:49 PM   #1
ashok.g
Member
 
Registered: Dec 2009
Location: Hyderabad,India
Distribution: RHEl AS 4
Posts: 215

Rep: Reputation: 32
perl is different in windows and linux..??


I came across a strange observation while I am working with perl in windows( Windows Vista) and in LINUX( RHEL AS 4). My observation is this:
Code:
#!usr/bin/perl
@a="ASHOK";
print $a[0];
In windows the output is "A" and in LINUX its "ASHOK".
Do perl have separate delimiters in different operating systems?
Why this is happening?
 
Old 01-08-2010, 02:07 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 452Reputation: 452Reputation: 452Reputation: 452Reputation: 452
Quote:
Originally Posted by ashok.g View Post
I came across a strange observation while I am working with perl in windows( Windows Vista) and in LINUX( RHEL AS 4). My observation is this:
Code:
#!usr/bin/perl
@a="ASHOK";
print $a[0];
In windows the output is "A" and in LINUX its "ASHOK".
Do perl have separate delimiters in different operating systems?
Why this is happening?
I think because you forgot to add new line, i.e. write

Code:
print $a[0], "\n";
in your code.

If my suggestion works, think about IO buffering and how shell prompt interferes with output.
 
Old 01-08-2010, 02:34 AM   #3
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,695
Blog Entries: 5

Rep: Reputation: 240Reputation: 240Reputation: 240
its definitely not a problem of new lines. I have no problems whether its run on Windows or *nix. the answer is "ASHOK" for both platforms. My platform : WinXP, Perl version 5.10.
 
Old 01-08-2010, 12:00 PM   #4
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,219

Rep: Reputation: 164Reputation: 164
Code:
C:\Users\XXXX>perl
#!usr/bin/perl
@a="ASHOK";
print $a[0];^Z
ASHOK
C:\Users\XXXX>
 
  


Reply

Tags
linux, perl, windows


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
is there gui that runs Perl programs for linux (or windows)? sunil_kb1 Linux - Newbie 1 07-07-2009 09:12 AM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 02:23 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 10:22 AM
Execution of PERL scripts in Linux which is compiled in WINDOWs environment to_veera Linux - Software 3 06-18-2004 08:50 AM


All times are GMT -5. The time now is 11:15 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration