develooper Front page | perl.perl5.porters | Postings from January 2001

[ID 20010128.001] Problem with list ...

Thread Next
From:
u99103
Date:
January 28, 2001 06:52
Subject:
[ID 20010128.001] Problem with list ...
Message ID:
200101281053.f0SArRl21128@cs7.cs.unipune.ernet.in

This is a bug report for perl from u99103@cs.unipune.ernet.in,
generated with the help of perlbug 1.28 running under perl v5.6.0.


-----------------------------------------------------------------
[Please enter your report here]

I want to break a long string in "file" to give me "file2" as output. 
For this, I tried following code:

### Start
open(fd,"file");
open(fd2,">file2");
@array = <fd>;
$i = 0;
for ($i*70; $i < @array/70; @i++)
{
	@temp = @array[$i..$i+70];
	print fd2 "@temp";
}
### End

To my surprise simply 

print "@array[1..10]";
OR 
print "$array[1..10]";

were giving me the whole file NOT only 10 characters.


Whether I am doing wrong or a BUG in perl?

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl v5.6.0:

Configured by root at Thu Apr 27 15:49:46 PDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.14, archname=i386-linux
    uname='linux zap 2.2.14 #20 fri feb 25 19:44:02 pst 2000 i686 unknown '
    config_args='-de -Dprefix=/usr -Darchname=i386-linux -Dprivlib=/usr/lib/perl5 -Darchlib=/usr/lib/perl5/i386-linux -Dsitelib=/usr/lib/perl5/site_perl -Dsitearch=/usr/lib/perl5/site_perl/i386-linux'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
    cppflags='-fno-strict-aliasing -I/usr/local/include'
    ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=/lib/libc-2.1.2.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    /usr/lib/perl5/i386-linux
    /usr/lib/perl5
    /usr/lib/perl5/site_perl/i386-linux
    /usr/lib/perl5/site_perl
    /usr/lib/perl5/site_perl
    .

---
Environment for perl v5.6.0:
    HOME=/home/stu/b-99/u99103
    LANG (unset)
    LANGUAGE (unset)
    LC_ALL=POSIX
    LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/usr/local/oracle/OraHome1/lib
    LOGDIR (unset)
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/openwin/bin:/usr/games:.:/opt/kde/bin:/usr/share/texmf/bin:/usr/local/jdk1.2.2/bin:/usr/local/saclib2.1/bin:/usr/local/oracle/OraHome1/bin:/home/stu/subjects/IP/1999/:/usr/bin:/usr/local/bin:/usr/local/gnu/bin:.:/usr/local/games/bin:/home/stu/b-99/u99103/Misc/mybin:/usr/bin/X11
    PERL_BADLANG (unset)
    SHELL=/sbin/bash


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About