Re: Array element split, with grep



Steve Bertrand wrote:
Hi all,

Can someone explain to me how I can fix this up to achieve my desired results?

my $time = (split (/:/, (grep (/^info/, @contents))))[0];

I figured it out :)

my $time = (split (/:/, (grep (/^info/, @contents))[0]))[0];

I neglected to realize that the result from grep was in scalar context until I specified it as an array.

Steve
.



Relevant Pages

  • Re: count files + dirs
    ... Paul Lalli wrote: ... > elements in the array. ... Fix for the "Why are you doing this":D ...
    (comp.lang.perl.misc)
  • [PULL REQUEST] md patches for merge window
    ... - raid5 cleanups from Dan Williams ... general code cleanup from Andre Noll ... md: md_ioctl: Fix misleading indentation. ... Don't reject HOT_REMOVE_DISK request for an array that is not yet started. ...
    (Linux-Kernel)
  • Re: JNI with multidimensional Byte Array
    ... First I strongly suggest that you compile ... for a 2-D char array. ... ReleaseCharArrayElements() should be ReleaseByteArrayElements, and ... can't help you fix the code you didn't post. ...
    (comp.lang.java.programmer)
  • Raid 10 Problems?
    ... Created a software raid 10 array. ... fix. ... Checking inodes, blocks, and sizes ...
    (Linux-Kernel)
  • patch fix-sys_move_pages-when-a-null-node-list-is-passed.patch queue
    ... Fix sys_move_pages when a NULL node list is passed. ... depends on a marker in the node field of the structure to decide how large ... the array is and this marker is correctly inserted into the last element ...
    (Linux-Kernel)